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

  • Stop wasting time looking for files and revisions. Connect your Gmail, DriveDropbox, and Slack accounts and in less than 2 minutes, Dokkio will automatically organize all your file attachments. Learn more and claim your free account.

View
 

Reading Light Sensor data on an Amber Display

Page history last edited by Dora 8 years, 2 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.