//Reads data from a sensor and sends it to the serial port //Created by Gleb Bulygin for FabAcademy. //Based on this tutorial: https://itp.nyu.edu/physcomp/labs/labs-serial-communication/serial-output-from-an-arduino/ #include const int pResistor = A0; // sensor pin uint16_t value; // Store value from photoresistor (0-1023) void setup() { while (!Serial) { ; // wait for serial port to connect. Needed for native USB port only } // set the data rate for the SoftwareSerial port Serial.begin(9600); // Serial.println("Hello, world");//test message } void loop() { int value = analogRead(pResistor); // map(value, 0, 1023, 0, 255); //mapping to fit in one bit of data. Serial.write(value); // sends the value in bin //delay(100); // delay }