Go Down

Topic: Printing to a printer (Read 779 times) previous topic - next topic


Oct 31, 2012, 05:36 am Last Edit: Oct 31, 2012, 05:41 am by conradin Reason: 1
hi all, I am trying to print to my printer, but I dont know what the character encoding should be like.
I have code that sends data to the printer, but the formating stinks.  How can I print clear messages to the printer using the arduino?
are there libraries to help format the printer output?
this line:
#!/bin/bash \n for i in `seq 0 255` \n do \n nslookup 130.111.192.$i | grep flex \n done
prints out like:
                           for i in `seq 0 255`
                                                                   nslookup 130.111.192.$i | grep flex

Code: [Select]

#include <Ethernet.h>
#include <SPI.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xCA, 0xFE };
byte ip[] = { 192, 168, 1, 17 };
char data[] = {"#!/bin/bash \n for i in `seq 0 255` \n do \n nslookup 130.111.192.$i | grep flex \n done"};
byte server[] = { 192, 168, 1, 24 };  // the printer
EthernetClient client;

void setup()
 Ethernet.begin(mac, ip);
 client.connect(server, 9100);

 //we told it to connect, lets check it with the "connected" function

 if (client.connected()) {
   Serial.println("connected to printer");

void loop()
// IDK I only want to print once.

Does anyone have more information about using the network functions for printing via the Arduino, and formatting printing?

I have all official hardware Arduino Uno, and Ethernet shield, and I run Linux if any of that matters.

Coding Badly



...in front of all...


Go Up