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.
Diff: main.cpp
- Revision:
- 1:e0fb0db3db3d
- Parent:
- 0:7bb832ad2fb8
- Child:
- 2:ed31b405067c
--- a/main.cpp Fri Feb 28 12:31:18 2014 +0000 +++ b/main.cpp Tue Mar 04 10:17:44 2014 +0000 @@ -7,11 +7,15 @@ int spi_mode_90393; int spi_bits_90393; - char u8_spi_read_buffer[8]; - char u8_spi_write_buffer[7]; - char hostCommand; - char hostAddress; - char hostData; + //char u8_spi_read_buffer[8]; + //char u8_spi_write_buffer[7]; + int pcCommand; + //char hostAddress; + char dataByte1; + char dataByte2; + char address; + char tempData1; + char tempData2; DigitalOut slaveSelect(p26); DigitalOut myled1(LED1); DigitalOut myled2(LED2); @@ -37,37 +41,43 @@ MLX90393 sensor(p26,&spi); printf("**********Creat sensor object complete********** \n\r"); - hostCommand = 'd'; + pcCommand = 4; while (1) { - pc.scanf(" %c", &hostCommand); - switch (hostCommand) { + pc.scanf(" %i, %i, %i", &pcCommand, &tempData1,tempData2); + switch (pcCommand) { - case 'a': { + case 0: { sensor.copyEEpromToRam(); break; } - case 'b': { + case 1: { sensor.readEEpromToHost(); break; } - case 'c': { - myled3=1; - pc.scanf(" %c %c", &hostAddress, &hostData); - myled4= 1; - int address = (int)hostAddress -48; - int data = (int)hostData -48; - - myled1 = address; - myled2 = data; - - //sensor.writeToEEprom(0x00) + case 2: { + pc.scanf(" %i, %i, %i", &dataByte2, &dataByte1, &address); + sensor.writeToEEprom(dataByte2,dataByte1,address); + break; + } + case 4: { + myled4=!myled4; + sensor.getStatus(); break; } - case 'd': { - + case 5: { + sensor.sendBurst(); break; } + case 6: { + sensor.startMeasurement(); + break; + } + case 7: { + sensor.readMeasurement(); + break; + } + } }