/* -*- c-mode -*- */ /* * Print the output of a light sensor on analog input 0. * A machine on the other end can read the serial output * and do something with it. * * by Akkana Peck * This is Free Software: share and enjoy under the terms of the * GNU Public License. */ #include int sensorPin = 0; void setup() { pinMode(sensorPin, INPUT); Serial.begin(9600); } void loop() { while (1) { int val = analogRead(sensorPin); Serial.println(val); delay(2000); } } /* Various sites say to add this to get around the missing symbol when * including Serial.println. No idea why it's an infinite loop. * The error otherwise is applet/core.a(Print.o):(.data+0x6): undefined reference to `__cxa_pure_virtual' * and comes from Print.h: virtual void write(uint8_t) = 0; */ extern "C" void __cxa_pure_virtual() { while (1) ; }