test aff8x8 avec 2*74HC595 (KRM2388AURPGB)
Fork of DigitalIn_test by
main.cpp
- Committer:
- ER4
- Date:
- 2015-03-09
- Revision:
- 1:5a049a86616a
- Parent:
- 0:592717f4890b
- Child:
- 2:a0e8e160bed1
File content as of revision 1:5a049a86616a:
#include "mbed.h" SPI spi(P0_9,P0_8,P0_7); // mosi, miso, sclk DigitalOut cs(P0_6); void ligne(char val){ cs = 0; //spi.write(val); spi.write(0xFF); cs = 1; } //void colone(char val1){ // cs=0; //spi.write(val1); //cs=1; //} /*char Im [8][8] = { {0,0,0,1,1,0,0,0}, {0,0,0,1,1,0,0,0}, {0,0,0,1,1,0,0,0}, {1,1,1,1,1,1,1,1}, {1,1,1,1,1,1,1,1}, {0,0,0,1,1,0,0,0}, {0,0,0,1,1,0,0,0}, {0,0,0,1,1,0,0,0}};*/ int main() { int i=0,j=0; // Chip must be deselected cs = 1; // Setup the spi for 8 bit data, high steady state clock, // second edge capture, with a 1MHz clock rate spi.format(8,3); spi.frequency(1000000); while(1){ for (j=0;j<=7;j++){ //spi.write(colone[j]); cs = 0; spi.write(~(1<<j));//colonnes spi.write(1<<i);//lignes //spi.write(0xFF); cs = 1; wait(0.1); } if(i==7) i=0; else i++; wait(0.1); //ligne(1<<i); //if(i==7) // i=0; // else // i++; // wait(0.5); // } } }