a. Based on the readings from the serial monitor, what is the range of the analog values being read?
0-1000
1024 = (2^10) = 10 bits
0-5V
Logorithmic. Goes up as soon as you touch it, but then it doesn't
In Examples->Basic->Fading the LED values range from 0-255. What do you have to do so that you get the full range of output voltages from the LED when using your FSR to change the LED color?
a. What resistance do you need to have in series to get a reasonable range of voltages from each sensor?
FSR- Logorithmic Video
Flex Sensor-Linear
Photo - linear
a. Modify the example code so that you can print out the output of the A0 pin. Include your code in your lab report.
It depends. If instead of a potentiometer, we have had another switch to select different states, the actions assigned to state wouldn't matter. In this case, if "Read" state is not inbetween the other two, we'd either read only 0 values or read only assigned values. We won't be able to have the read work for both states. So, it matters if we can't change the input method.
1024
d. How would you get analog data from the Arduino analog pins to be byte-sized? How about analog data from the I2C devices?
A byte is ranged 0-255. The analog data that we get is upto 1023. So, we'll split 1024 to four parts and store that to eprom. I2C devices are sending 1 byte of data.
e. Alternately, how would we store the data if it were bigger than a byte? (hint: take a look at the EEPROMPut example)
Put method handles custom structures to be stored in EPROM.
//Data to store. MyObject customVar = { 3.14f, 65, "Working!" };
eeAddress += sizeof(float); EEPROM.put(eeAddress, customVar);