| 
  • Earn a $50 Amazon gift card for testing a new product from the makers of PBworks. Click here to apply.

  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

View
 

Reading Light Sensor data on an Amber Display

Page history last edited by Dora 7 years, 7 months ago

 

   

 

 

 

 

 

 

 

 

 

 

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
}

 

 

 

 

 

Comments (0)

You don't have permission to comment on this page.