Created
May 31, 2011 11:39
-
-
Save tomoyo-kousaka/1000361 to your computer and use it in GitHub Desktop.
tokeiEx(Arduino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int sensorPin = A0; | |
int val = 0; | |
int ledPin = 13; | |
int sensorValue = 0; | |
float times = 0; | |
int send; | |
void setup() { | |
Serial.begin(9600); | |
pinMode(2, INPUT); | |
pinMode(13,OUTPUT); | |
} | |
void loop() { | |
val = digitalRead(2); // read input value | |
int sensorValue = analogRead(A0); | |
times = ((sensorValue-100)/14.5); | |
if(times<0)times=0; | |
else if(times>60)times=60; | |
Serial.println(times,BYTE); | |
if(val == HIGH){ | |
digitalWrite(13,HIGH); | |
delay(1000); | |
digitalWrite(13,LOW); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment