Little Bird Curriculum / code littlebird.com.au
eagled-light-3d.ino Arduino (C/C++) 10 lines · 0 views ✦ Open in English IDE Raw Download Embed view
const byte LIGHT_PIN = A9;
const float REFERENCE_V = 3.3;
void setup() { Serial.begin(9600); }
void loop() {
  int light = analogRead(LIGHT_PIN);
  float volts = light * (REFERENCE_V / 1023.0);
  Serial.print("light:"); Serial.print(light);
  Serial.print(",volts:"); Serial.println(volts, 3);
  delay(100);
}

Embed this snippet

As an iframe:

Or drop it inline with a script tag (injects the highlighted block where included):

Shared from Little Bird Electronics curriculum.

Copied to clipboard