CODE
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// print out the value you read:
Serial.println(sensorValue);
delay(1); // delay in between reads for stability
}
數值會與亮度成正比 |
CODE
int analogPin = 0;
int RED = 0;
void setup(){
Serial.begin(9600);
Serial.println("CLEARDATA");
Serial.println("LABEL,Time,Timer,RED");
}
void loop(){
RED = analogRead(analogPin);
Serial.print("DATA,TIME");
Serial.print(",");
Serial.print("TIMER");
Serial.print(",");
Serial.print(RED);
Serial.print(",");
delay(100);
}
沒有留言:
張貼留言