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 #include "platform/mbed_thread.h" 00003 #include "RPinName.h" 00004 00005 // Blinking rate in milliseconds 00006 #define loopdelay 1000 00007 #define betweenleds 500 00008 00009 00010 int main() 00011 { 00012 00013 // Initialise the digital pins for LEDs as an output 00014 DigitalOut ledg(led1); // WiFi or same as LED1 00015 DigitalOut ledb(led2); // Azure 00016 DigitalOut ledy(led3); // User 00017 00018 // Initialise the pulse-width-moudulation for RGB LED 00019 PwmOut RGBR(RedRGB); 00020 PwmOut RGBG(GreenRGB); 00021 PwmOut RGBB(BlueRGB); 00022 00023 Serial AZ(tx, rx); // tx, rx 00024 00025 while (true) { 00026 AZ.printf("Hi There from Appa\r\n"); 00027 00028 RGBR = 0; 00029 AZ.printf("Random Green RGB LED\r\n"); 00030 RGBG = rand() % 100; 00031 AZ.printf("Not Green LED\r\n"); 00032 ledg = !ledg; 00033 thread_sleep_for(betweenleds); 00034 RGBG = 0; 00035 AZ.printf("Random Blue RGB LED\r\n"); 00036 RGBB = rand() % 100; 00037 AZ.printf("Not Blue LED\r\n"); 00038 ledb = !ledb; 00039 thread_sleep_for(betweenleds); 00040 RGBB = 0; 00041 AZ.printf("Random Red RGB LED\r\n"); 00042 RGBR = rand() % 100; 00043 AZ.printf("Not Red LED\r\n"); 00044 ledy = !ledy; 00045 thread_sleep_for(loopdelay); 00046 } 00047 }
Generated on Fri Jul 29 2022 10:17:43 by
1.7.2