Small Change
Dependencies: APDS_9960 TextLCD mbed
Fork of Si4703 by
Diff: main.cpp
- Revision:
- 2:8f479ed18d48
- Parent:
- 1:563a11fe39e0
- Child:
- 3:189500a3c510
diff -r 563a11fe39e0 -r 8f479ed18d48 main.cpp --- a/main.cpp Tue Oct 20 14:58:05 2015 +0000 +++ b/main.cpp Mon Mar 20 17:48:47 2017 +0000 @@ -3,18 +3,18 @@ #include "TextLCD.h" Serial pc(USBTX, USBRX); -Si4703_Breakout radio(p28, p27, p26, &pc); // (sda, scl, rst, Serial) -DigitalIn chanUp(p17); -DigitalIn chanDown(p18); -DigitalIn volUp(p19); -DigitalIn volDown(p20); -TextLCD lcd(p16, p15, p14, p13, p12, p11); // rs, e, d4-d7 +Si4703_Breakout radio(PTD9, PTD8, PTB11, &pc); // (sda, scl, rst, Serial) PTD9, PTD8, PTB11, &pc); +DigitalIn chanUp(PTA12); +DigitalIn chanDown(PTA13); +DigitalIn volUp(PTC16); +DigitalIn volDown(PTC17); +TextLCD lcd(PTE6, PTD15, PTD4, PTD5, PTD6, PTD7); // rs, e, d4-d7 int main(int argc, char** argv) { - int chan = 901; + int chan = 963; int vol = 9; radio.powerOn(); radio.setVolume(vol); // range: 0-15 @@ -27,61 +27,61 @@ pc.printf(" volume = '%d'\n", radio.getVolume()); - while(1){ - if(chanUp) { - chan++; - radio.setChannel(chan); - lcd.cls(); - lcd.printf("channel = '%d'", radio.getChannel()); - lcd.printf(" volume = '%d'\n", radio.getVolume()); - pc.printf("channel = '%d'", radio.getChannel()); - pc.printf(" volume = '%d'\n", radio.getVolume()); - wait(.25); - } - if(chanDown) { - chan--; - radio.setChannel(chan); - lcd.cls(); - lcd.printf("channel = '%d'", radio.getChannel()); - lcd.printf(" volume = '%d'\n", radio.getVolume()); - pc.printf("channel = '%d'", radio.getChannel()); - pc.printf(" volume = '%d'\n", radio.getVolume()); - wait(.25); - } - if(volUp && vol <= 14) { - vol++; - radio.setVolume(vol); - lcd.cls(); - lcd.printf("channel = '%d'", radio.getChannel()); - lcd.printf(" volume = '%d'\n", radio.getVolume()); - pc.printf("channel = '%d'", radio.getChannel()); - pc.printf(" volume = '%d'\n", radio.getVolume()); - wait(.25); - } - if(volUp && vol == 15) { - lcd.cls(); - lcd.printf("channel = '%d'", radio.getChannel()); - lcd.printf(" Max Volume\n", radio.getVolume()); - pc.printf("Max Volume\n"); - wait(.25); - } - if(volDown && vol >= 1) { - vol--; - radio.setVolume(vol); - lcd.cls(); - lcd.printf("channel = '%d'", radio.getChannel()); - lcd.printf(" volume = '%d'\n", radio.getVolume()); - pc.printf("channel = '%d'", radio.getChannel()); - pc.printf(" volume = '%d'\n", radio.getVolume()); - wait(.25); - } - if(volDown && vol == 0) { - lcd.cls(); - lcd.printf("channel = '%d'", radio.getChannel()); - lcd.printf(" Min Volume\n", radio.getVolume()); - pc.printf("Min Volume\n"); - wait(.25); - } - - } + // while(1){ +// if(chanUp) { +// chan++; +// radio.setChannel(chan); +// lcd.cls(); +// lcd.printf("channel = '%d'", radio.getChannel()); +// lcd.printf(" volume = '%d'\n", radio.getVolume()); +// pc.printf("channel = '%d'", radio.getChannel()); +// pc.printf(" volume = '%d'\n", radio.getVolume()); +// wait(.25); +// } +// if(chanDown) { +// chan--; +// radio.setChannel(chan); +// lcd.cls(); +// lcd.printf("channel = '%d'", radio.getChannel()); +// lcd.printf(" volume = '%d'\n", radio.getVolume()); +// pc.printf("channel = '%d'", radio.getChannel()); +// pc.printf(" volume = '%d'\n", radio.getVolume()); +// wait(.25); +// } +// if(volUp && vol <= 14) { +// vol++; +// radio.setVolume(vol); +// lcd.cls(); +// lcd.printf("channel = '%d'", radio.getChannel()); +// lcd.printf(" volume = '%d'\n", radio.getVolume()); +// pc.printf("channel = '%d'", radio.getChannel()); +// pc.printf(" volume = '%d'\n", radio.getVolume()); +// wait(.25); +// } +// if(volUp && vol == 15) { +// lcd.cls(); +// lcd.printf("channel = '%d'", radio.getChannel()); +// lcd.printf(" Max Volume\n", radio.getVolume()); +// pc.printf("Max Volume\n"); +// wait(.25); +// } +// if(volDown && vol >= 1) { +// vol--; +// radio.setVolume(vol); +// lcd.cls(); +// lcd.printf("channel = '%d'", radio.getChannel()); +// lcd.printf(" volume = '%d'\n", radio.getVolume()); +// pc.printf("channel = '%d'", radio.getChannel()); +// pc.printf(" volume = '%d'\n", radio.getVolume()); +// wait(.25); +// } +// if(volDown && vol == 0) { +// lcd.cls(); +// lcd.printf("channel = '%d'", radio.getChannel()); +// lcd.printf(" Min Volume\n", radio.getVolume()); +// pc.printf("Min Volume\n"); +// wait(.25); +// } +// +// } } \ No newline at end of file