- void setup() {
- // put your setup code here, to run once:
- Serial.begin(9600);
- pinMode(13,OUTPUT);
- }
- //ここで使うピンを指定、OUTPUT(電流を流す) or INPUT(データの取得等)
- void loop() {
- // put your main code here, to run repeatedly:
- int val=0;
- val=analogRead(1);
- Serial.println(val);
- delay(500);
- if(val<200){
- digitalWrite(13,LOW);
- }else{
- digitalWrite(13,HIGH);
- }
- //値が200以下ならを電流を流さない、そうでなければ流す
- }