Hello all,
I'm attempting a microprinter project inspired by Tom Taylor tomtaylor.co.uk/projects/microprinter
I have an old Verifone Serial Printer with an RS232 port. Using a Max 233 chip and a wiring diagram found here.
flipbit.co.uk/micro-printer.html
I figured out the command codes and can print directly to the printer from the Arduino and use some formatting (red ribbon, double wide, line feed etc.)
My goal is to connect the arduino with an Ethernet Shield to the web and print out daily digest style reports (weather, latest tweets etc.). Python seems to be a good way to scrape sites/feed and gather the content which the arduino will read and then print in a format I design.
The problem is that I cannot get the Arduino sketch to read (or the Python script to supply) content. This test Python script
import serial # if you have not already done so
import time
ser = serial.Serial('/dev/ttyUSB0', 9600)
time.sleep(2)
ser.write('Goodnight Moon!')
#this goes to the printer but only the first letter is printed over and over
Combined with this Arduino sketch
/this sketch prints the first letter of pyPrintTest.py over and
over/
#include <NewSoftSerial.h>NewSoftSerial mySerial(3, 2);
char myString[ ] = {Serial.read( )};
void setup()
{
Serial.begin(9600);
Serial.println(myString[1]);// set the data rate for the NewSoftSerial port
mySerial.begin(9600);
mySerial.println(myString[1]);
}void loop() // run over and over again
{if (mySerial.available()) {
Serial.print(myString[1]);
}
if (Serial.available()) {
mySerial.print(myString[1]);}
// delay(2000); I commented out the delay since putting it in stops everything!
}
Just prints the first letter of the copy in the Python script again and again (so "G" in this example but "H" if I replace the G with an H).
From looking around I think my issue might be to do with making the Arduino look for a string of text but I'm stumped. Ultimately I want to have a bunch of scripts running (via cron or similar) that will output to a file (pickle or .json) that the Arduino will read.
Any suggestions gratefully received.