So I get a compile error for Setup and Loop on this code, I am not sure what version C++ the Arduino in CRUMB is using but I thought I did this right, any suggestions?
//Transmit rate in bps
#define TX_RATE 5
//Pin Assignments
#define TX_DATA 3
#define LCD_D4 4
#define LCD_D5 5
#define LCD_D6 6
#define LCD_D7 7
#define LCD_RS 8
#define LCD_EN 9
constchar*message = "Hello, world!";
voidsetup(){
pinMode(TX_DATA, OUTPUT);
//LCD Initialize
LiquidCrystal lcd(LCD_RS, LCD_EN, LCD_D4, LCD_D5, LCD_D6, LCD_D7);
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print(message);
for(int byte_idx = 0; byte_idx < sizeof(message); byte_idx++){
char tx_byte = message[byte_idx];
lcd.noCursor();
lcd.setCursor(0, 1);
lcd.print(" ");
lcd.setCursor(byte_idx, 0);
lcd.cursor();
for(int bit_idx = 0; bit_idx < 8; bit_idx++){
bool tx_bit = tx_byte &(0x80 >> bit_idx);
digitalWrite(TX_DATA, tx_bit);
lcd.noCursor();
lcd.setCursor(bit_idx, 1);
lcd.print(tx_bit ?"1" : "0");
lcd.setCursor(byte_idx, 0);
lcd.cursor();
delay(1000 / TX_RATE);
}
}
digitalWrite(TX_DATA, LOW);
}
voidloop(){
}
Hey! So, first of all… I don’t see any #include for the Liquid Crystal display library… which isn’t included as standard with CRUMB… only the TFT library which can be found in the Arduino Folder of the CRUMB install Take a look at the Pong Example in Crumb and then take a look at the official arduino TFT reference online and you will find that it is possible to achieve what you are trying todo above 😊 The upcoming update will expose the source code I am using abit more clearly and allow you to expand, using the built in set of arduino functions