Small Change

Dependencies:   APDS_9960 TextLCD mbed

Fork of Si4703 by kris gjika

main.cpp

Committer:
nciulla
Date:
2017-03-20
Revision:
2:8f479ed18d48
Parent:
1:563a11fe39e0
Child:
3:189500a3c510

File content as of revision 2:8f479ed18d48:

#include "mbed.h"
#include "SparkFun-Si4703.h"
#include "TextLCD.h"

Serial pc(USBTX, USBRX);
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 = 963;
    int vol = 9;
    radio.powerOn();
    radio.setVolume(vol); // range: 0-15
    radio.setChannel(chan); // 90.1 WABE  
    
    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());  
 
    
   // 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);
//        }
//
//    }
}