keyestudio
www.keyestudio.cc
96
Sample program
//////////////////////////////////////////////////////////
float temp; // create a floating-point type variable temp as storage space for storing data
void setup()
{
Serial.begin(9600);
// use 9600 baud rate to have serial communication
}
void loop()
{
int V1 = analogRead(A0);
// Read the voltage data from A0 port and store it in the newly created integer variables V1;
measurement range of voltage from analog port is 0 to 5V; return value of 0-1023.
float vol = V1*(5.0 / 1024.0);
// We convert V1 value into actual voltage value and store it into floating-point variable vol
if (vol == temp)
// The judgment here is used to filter repeated data; only voltage value that is differ than the last
one will be output.
{
temp = vol; // After comparison is completed, store the value in variable temp
}
else
{
Serial.print(vol);
// Serial port outputs voltage value, in the same line
Содержание ARDUINO maker learning kit
Страница 1: ...keyestudio www keyestudio cc ARDUINO maker learning kit...
Страница 23: ...keyestudio www keyestudio cc 21 Connection for 2560 R3...
Страница 30: ...keyestudio www keyestudio cc 28 Connection for 2560 R3...
Страница 39: ...keyestudio www keyestudio cc 37 Connection for 2560 R3...
Страница 43: ...keyestudio www keyestudio cc 41 Connection for 2560 R3...
Страница 46: ...keyestudio www keyestudio cc 44 Connection for 2560 R3...
Страница 50: ...keyestudio www keyestudio cc 48 Connection for 2560 R3...
Страница 53: ...keyestudio www keyestudio cc 51 Connection circuit as below Connection for R3 Connection for 2560 R3...
Страница 58: ...keyestudio www keyestudio cc 56 Connection for 2560 R3...
Страница 62: ...keyestudio www keyestudio cc 60 Connection for 2560 R3...
Страница 65: ...keyestudio www keyestudio cc 63 Circuit connection Connection for R3...
Страница 66: ...keyestudio www keyestudio cc 64 Connection for 2560 R3...
Страница 69: ...keyestudio www keyestudio cc 67 Pic 2 Project 15 LM35 temperature sensor...
Страница 71: ...keyestudio www keyestudio cc 69 Connection for 2560 R3 Sample program...
Страница 74: ...keyestudio www keyestudio cc 72 Schematic diagram...
Страница 77: ...keyestudio www keyestudio cc 75 Circuit connection Connection for R3...
Страница 78: ...keyestudio www keyestudio cc 76 Connection for 2560 R3...
Страница 80: ...keyestudio www keyestudio cc 78 Result...
Страница 82: ...keyestudio www keyestudio cc 80 Connection for 2560 R3...
Страница 85: ...keyestudio www keyestudio cc 83 Schematic diagram Circuit connection Connection for R3...
Страница 91: ...keyestudio www keyestudio cc 89 Circuit connection Connection for R3...
Страница 92: ...keyestudio www keyestudio cc 90 Connection for 2560 R3...
Страница 95: ...keyestudio www keyestudio cc 93...
Страница 96: ...keyestudio www keyestudio cc 94...
Страница 104: ...keyestudio www keyestudio cc 102 Connection for 2560 R3...
Страница 111: ...keyestudio www keyestudio cc 109 Connection for R3 Connection for 2560 R3...
Страница 120: ...keyestudio www keyestudio cc 118 Connection for 2560 R3...
Страница 124: ...keyestudio www keyestudio cc 122 Connection for R3 Connection for 2560 R3...
Страница 135: ...keyestudio www keyestudio cc 133 Connection for R3 Connection for 2560 R3...
Страница 139: ...keyestudio www keyestudio cc 137 Circuit connection Connection for uno R3...
Страница 140: ...keyestudio www keyestudio cc 138 Connection for 2560 R3...
Страница 144: ...keyestudio www keyestudio cc 142 Circuit connection Connection for R3...
Страница 145: ...keyestudio www keyestudio cc 143 Connection for 2560 R3...
Страница 148: ...keyestudio www keyestudio cc 146 Connection for 2560 R3 Sample program...
Страница 155: ...keyestudio www keyestudio cc 153 Circuit connection Connection for R3...
Страница 156: ...keyestudio www keyestudio cc 154 Connection for 2560 R3...
Страница 160: ...keyestudio www keyestudio cc 158 Connection for 2560 R3...