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.
Revision 0:6bae2bca8042, committed 2010-07-14
- Comitter:
- gadgetcafe03
- Date:
- Wed Jul 14 10:04:40 2010 +0000
- Commit message:
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Jul 14 10:04:40 2010 +0000
@@ -0,0 +1,36 @@
+#include "mbed.h"
+
+PwmOut led[4] = {PwmOut(LED1), PwmOut(LED2), PwmOut(LED3), PwmOut(LED4), };
+
+int myrand()
+{
+ static int pr1 = 892327, pr2 = 372, s = 522, mod = 75;
+
+ s = (pr1 * s + pr2) % mod;
+
+ return s;
+}
+
+void toAray(int n, int *a)
+{
+ for (int i=0; i<4; i++)
+ {
+ a[i] = n & 1;
+ n >>= 1;
+ }
+}
+
+int main() {
+ int n[4] = {0, 0, 0, 0,};
+ int m = 0;
+
+ while(1) {
+ toAray(myrand(), n);
+ for (int i=0; i<4; i++)
+ {
+ led[i] = n[i];
+ }
+ m++;
+ wait(1);
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Jul 14 10:04:40 2010 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9114680c05da