sketch_oct24a.ino: In function 'void setup()':
sketch_oct24a:9: error: expected `;' before 'delay'
sketch_oct24a.ino: In function 'void loop()':
sketch_oct24a:15: error: 'class Adafruit_ssd1306syp' has no member named 'message'
I'm a amateur of Arduino, I want to set a global variable , when SMS receive, the android will send the SMS
through Bluetooth, then the arduino will receive the SMS and display it in OLED
OK. Have you got any hardware and code to receive the SMS via Bluetooth on the Arduino ?
Does the Adafruit library come with any examples of how to display text on the OLED ?
Have you at least fixed the problem with the semi-colons ?
Now I fix my code, it can display the variables in the monitor now, but I still don't know how to
display it in the adafruit12864 OLED, here's my now code:
#define max_char 100
char message[max_char]; // stores you message
char r_char; // reads each character
byte index = 0; // defines the position into your array
int i;
#include <Adafruit_ssd1306syp.h>
#define SDA_PIN 8
#define SCL_PIN 9
Adafruit_ssd1306syp display(SDA_PIN,SCL_PIN);
void setup()
{
Serial.begin(9600);
delay(1000);
display.initialize();
}
void loop()
{
if(Serial.available()){
for(i=0; i<99; i++){
message[i] = '\0';
}
//resests the index
index=0;
}
//while is reading the message
while(Serial.available() > 0)
{
//the message can have up to 100 characters
if(index < (max_char-1))
{
r_char = Serial.read(); // Reads a character
message[index] = r_char; // Stores the character in message array
index++; // Increment position
message[index] = '\0'; // Delete the last position
}
}
Serial.println(message);
display.drawLine(0, 0, 127, 63,WHITE);
display.update();
delay(100);
display.clear();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.println(max_char);
delay(2000);
}
I only can see a line on the screen when the OLED initialized, then it stay there all the time
It didn't clear screen at all.
The OLED can displayed word when I quote it like ( display.println("hello, world")