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 1-09-06-Uebung by
main.cpp
- Committer:
- marcel1691
- Date:
- 2016-03-25
- Revision:
- 2:0362ad565944
- Parent:
- 1:4e24bd21f2ce
- Child:
- 3:e612c5f0c23d
File content as of revision 2:0362ad565944:
/** 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 < 6; p++ ) spi.write( strip[p] ); } void clearLED() { for ( int p = 0; p < 6; 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() ); } }