LinkIt 7697的內建LED做呼吸燈
http://download.labs.mediatek.com/package_mtk_linkit_7697_index.json
Arduino 程式如下
#include <SPI.h> int led; int fade; void setup() { // LED=LED_BUILTIN; pinMode(LED_BUILTIN, OUTPUT); led = 0; fade = 5; digitalWrite(LED_BUILTIN, LOW); Serial.begin(9600); } void loop() { analogWrite(LED_BUILTIN, led); led = led + fade; if (led <= 0) { fade = 5; } else if (led >= 255) { fade = -5; } Serial.println(led); delay(30); } }
沒有留言:
張貼留言