Reading Light Sensor data on an Amber Display


 

   

 

 

 

 

 

 

 

 

 

 

The code uploaded to the Arduino is here:

/**
 * PrintTest
 * Arduino example by Mike Gionfriddo and Chris Ladden
 *
 * This example demonstrates sending analog
 * values to the serial port. This sketch
 * is simply broadcasting an analog value
 * as a packet.
 *
 * Notes:
 *      1.) Set the baud rate
 *      2.) Read some analog value
 *      3.) Print the value to the serial port
 */

void setup()
{
    Serial.begin(115200);//setup a serial port with a baud of 115200
    
    pinMode(18, OUTPUT);
    pinMode(19, OUTPUT);
    digitalWrite(18, HIGH);
    digitalWrite(19, LOW);
}

void loop()
{
    int value = analogRead(3); //read arduino analog pin 3 and save it as an int to value
    delay(1000);//delay 1,000ms
    char out[200];//create a 200 integer array
    
    sprintf(out, "hi\nLight=%d\n", value);//prep the out file
    Serial.print(out);//print the out array
}