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 00003 PwmOut led[4] = {PwmOut(LED1), PwmOut(LED2), PwmOut(LED3), PwmOut(LED4), }; 00004 00005 int myrand() 00006 { 00007 static int pr1 = 892327, pr2 = 372, s = 522, mod = 75; 00008 00009 s = (pr1 * s + pr2) % mod; 00010 00011 return s; 00012 } 00013 00014 void toAray(int n, int *a) 00015 { 00016 for (int i=0; i<4; i++) 00017 { 00018 a[i] = n & 1; 00019 n >>= 1; 00020 } 00021 } 00022 00023 int main() { 00024 int n[4] = {0, 0, 0, 0,}; 00025 int m = 0; 00026 00027 while(1) { 00028 toAray(myrand(), n); 00029 for (int i=0; i<4; i++) 00030 { 00031 led[i] = n[i]; 00032 } 00033 m++; 00034 wait(1); 00035 } 00036 }
Generated on Wed Jul 27 2022 09:38:58 by
1.7.2