Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of InterruptIn_HelloWorld by
main.cpp
00001 #include "mbed.h" 00002 00003 DigitalIn sensor(D2,PullUp); 00004 Serial pc(SERIAL_TX, SERIAL_RX); 00005 DigitalOut led(D13); 00006 00007 void setup() 00008 { 00009 pc.baud(9600); 00010 } 00011 00012 void loop() 00013 { 00014 int sensorVal = sensor.read(); 00015 pc.printf("%f\n", sensorVal); 00016 00017 if (sensorVal == 1) led = 1; // turn LED on: 00018 else led = 0; // turn LED off: 00019 } 00020 00021 int main() 00022 { 00023 setup(); 00024 while(1) loop(); 00025 }
Generated on Sun Jul 31 2022 14:19:48 by
1.7.2
