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
- Committer:
- gadgetcafe03
- Date:
- 2010-07-14
- Revision:
- 0:6bae2bca8042
File content as of revision 0:6bae2bca8042:
#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);
}
}