Arduino 穿戴裝置

Eddie Chen
1 min readJun 1, 2020

--

LED三色燈測距警示顯示

楊楚崧,陳凱文

int pin1;

int val;

void setup()
{
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
Serial.begin(9600);

}

void loop()
{
pin1 = analogRead(A0);
val = pin1;
val = (map(val,0,1023,100,200));
analogWrite(9, (200-val)/5);
analogWrite(10, (val-100)/5);
Serial.println(val);
}

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response