15 fd = open("/dev/ttyACM0", O_RDONLY);
18 std::cerr << "Can not open /dev/ttyACM0.\n";
27 bytes = read(fd, buf, 500);
30 // Read a sample value from the AD converter
31 // Voltage = 4.84 V * sample / 1023 ( Reference voltage = 4.84 )
32 // LDR resistance = Voltage * 10000 Ohm /(4.84V - Voltage)
34 if (buf[0] >= '0' && buf[0] <= '9')
37 std::cout << timestamp << "," << buf ;