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.
Dependencies: mbed
Fork of FernsehSimulator by
main.cpp
- Committer:
- marcel1691
- Date:
- 2016-03-31
- Revision:
- 3:e612c5f0c23d
- Parent:
- 2:0362ad565944
- Child:
- 4:f6840272e341
File content as of revision 3:e612c5f0c23d:
/** Zahlfallszahlen erzeugen und damit Fernsehsimulator fuettern
*/
#include "mbed.h"
#include <time.h>
SPI spi(D11, NC, D13); // mosi, miso, sclk
AnalogIn poti( A0 );
/** 3 x 3 Werte */
unsigned int strip[9];
void writeLED()
{
for ( int p = 0; p < 9; p++ )
spi.write( strip[p] );
}
void clearLED()
{
for ( int p = 0; p < 9; p++ )
{
strip[p] = 0;
spi.write( strip[p] );
}
}
int main()
{
printf( "LED Strip Test \n" );
spi.format( 8,0 );
spi.frequency( 800000 );
clearLED();
time_t t;
time(&t);
srand( (unsigned int)t ); /* Zufallsgenerator initialisieren */
while ( 1 )
{
for ( int i = 0; i < 9; i++ )
strip[i] = rand() % 64 + 1;
writeLED();
wait( poti.read() );
}
}
