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 "TextLCD.h" 00003 DigitalOut myled(LED1); 00004 TextLCD lcd(p24, p26, p27, p28, p29, p30, TextLCD::LCD16x2); // rs, e, d4-d7 00005 DigitalOut leds[] = {(LED1), (LED2),(LED3),(LED4)}; 00006 00007 int main() { 00008 long i, j, k, ii = 0; 00009 00010 for( i=3; i <= 10002000; i += 2 ){ 00011 k = 1; 00012 for(j = 3; j < i / 2; j +=2 ){ 00013 if(i % j == 0) {k= 0; break;} 00014 } 00015 if( k == 1 ){ 00016 lcd.printf("%8d", i); 00017 leds[0] = ii % 2; 00018 leds[1] = ii % 4 >> 1; 00019 leds[2] = ii % 8 >> 2; 00020 leds[3] = ii % 16 >> 3; 00021 ii++; 00022 if(i > 10000000) break; 00023 } 00024 } 00025 00026 }
Generated on Sat Aug 6 2022 13:38:58 by
1.7.2