Hi! I’m very new to Processing and coding but I’m trying to print the content of an RSS Feed to print through a receipt/ thermal printer.
I can print text through the MyPort.Write function but it’d be great if it would print all the content without anything having to be typed in. I get the content coming up in the run window, just trying to get it to print.
Any help would be amazing!
import processing.serial.*;
Serial myPort; // Create object from Serial class
int val; // Data received from the serial port
void setup() {
String portName = Serial.list()[2];
printArray(Serial.list());
myPort = new Serial(this, portName, 19200);
// Send a capital A out the serial port:
myPort.write(0x1B);
//ESC POS command
myPort.write('@');
//ESC POS initialize followed after command
myPort.write("news news ahahahahahaha()");
//Print "Hola Epson" to buffer
myPort.write(0xA);
//Print and Line Feed from B
}
void draw() {
XML xml;
//String url = "http://rss.news.yahoo.com/rss/topstories";
//XMLElement rss = new XMLElement(this, url);
xml = loadXML("https://www.theguardian.com/international/rss");
XML channel = xml.getChild("channel");
XML[] items = channel.getChildren("item");
for (int i = 0; i < items.length; i++) {
//int id = children[i].getInt("id");
//String coloring = children[i].getString("species");
//String name = items[i].getContent();
XML title = items[i].getChild("title");
println(i);
text(title.getContent(), 10, i*15);
}
}