arduino: bridge tra display lcd e lcdproc
Inviato: 22 apr 2012, 13:23
Oggi ho trovato questo: http://www.milesburton.com/USD_LCD_Disp ... ia_Arduino
In pratica consente di gestire un display lcd tramite lcdproc utilizzando arduino come bridge (usbizzando il display che viene visto tramite la porta seriale virtuale dell'arduino).
Ho provato a collegare l'arduino con l'interfaccia 2WIRE, questo e' lo sketch adattato per la newliquidcristal.
saluti ragno
In pratica consente di gestire un display lcd tramite lcdproc utilizzando arduino come bridge (usbizzando il display che viene visto tramite la porta seriale virtuale dell'arduino).
Ho provato a collegare l'arduino con l'interfaccia 2WIRE, questo e' lo sketch adattato per la newliquidcristal.
Codice: Seleziona tutto
#include <Wire.h>
#include <LiquidCrystal_SR.h>
LiquidCrystal_SR lcd(7,8,TWO_WIRE);
// | | + enable
// | \-- Clock Pin
// \---- Data/Enable Pin
// these constants won't change. But you can change the size of
// your LCD using them:
const int numRows = 2;
const int numCols = 24;
void setup() {
Serial.begin(9600);
// set up the LCD's number of rows and columns:
lcd.begin(numRows, numCols);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("LCD Proc pass through...");
lcd.setCursor(0,1);
}
byte serial_getch(){
int incoming;
while (Serial.available()==0){
}
// read the incoming byte:
incoming = Serial.read();
return (incoming &0xff);
}
void loop(){
byte rxbyte;
byte temp;
rxbyte = serial_getch(); // Fetch byte
if(rxbyte==0xFE) // If command
{
lcd.command(serial_getch()); // Pass through
}
else{
lcd.write(rxbyte); //Otherwise just dump it as text
}
}