Lチカ(オンボードLED)


while true
  leds_write(1)
  sleep(1)
  leds_write(0)
  sleep(1)
end
			

pinMode(0,0)
while true
  digitalWrite(0,1)
  sleep 1
  digitalWrite(0,0)
  sleep 1
end
      


pinMode(20,0)
while true
  digitalWrite(20,1)
  sleep 1
  digitalWrite(20,0)
  sleep 1
end
      

http://wiki.seeedstudio.com/Grove-Button/

pinMode(0,0)
pinMode(16,1)
while true
  leds_write(digitalRead(16))
end
      

7セグメントLED

74HC4511を使用するとleds_write(0,1,5,6pin)から簡単に出力できる。

j = 0
while true
  leds_write(j)
  j = j + 1
  if(j==10)
    j = 0
  end
  sleep(1)
end
      

リレー:https://www.switch-science.com/catalog/807/

  pinMode(0,0)
  pinMode(16,1)
  while true
    digitalWrite(16,1)
    sleep(1)
    digitalWrite(16,0)
    sleep(1)
  end