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.
main.cpp
00001 #include "mbed.h" 00002 DigitalOut leds[] = { 00003 DigitalOut( P0_19 ), 00004 DigitalOut( P0_18 ), 00005 DigitalOut( P0_17 ) 00006 }; 00007 DigitalIn sws[] = { 00008 DigitalIn( P0_14 ), 00009 DigitalIn( P0_15 ), 00010 DigitalIn( P0_16 ) 00011 }; 00012 BusOut ledBus( P0_21, P0_3, P0_2, P0_20,P1_19 ); 00013 AnalogIn adc(P0_23); 00014 int a =0; 00015 int main() 00016 { 00017 00018 for(int i = 0; i <3; i++){ 00019 sws[i].mode(PullUp); 00020 } 00021 00022 while(1) { 00023 ledBus = int(adc.read()*16); 00024 for(int i = 0; i <3; i++){ 00025 leds[i] = !sws[i]; 00026 } 00027 }/* 00028 while(1) { 00029 ledBus = 0b10101; 00030 wait(2); 00031 for(int i = 0; i <32; i++) { 00032 ledBus = i; 00033 wait_us(i*20); 00034 } 00035 }*/ 00036 }
Generated on Thu Jul 14 2022 14:36:41 by
1.7.2