BASIC4MCU | 질문게시판 | 답변 : 아두이노 질문
페이지 정보
작성자 master 작성일2021-12-13 09:18 조회748회 댓글1건본문
#include <Arduino.h>
#include <Wire.h>
#include <radio.h>
#include <TEA5767.h>
#include <LiquidCrystal.h>
#define FIX_BAND RADIO_BAND_FM
LiquidCrystal lcd(12,11,5,4,3,2);
/// The station that will be tuned by this sketch is 89.30 MHz.
TEA5767 radio;
uint8_t test1,test2,mode=0;
//
int station_tbl[8]={8970,9530,9650,9930,10130,10230,10390,10510};
char serial_tbl[8][35]={
"kbs대구 89.7Mhz ","MBS FM4U 95.3Mhz ","대구mbc 표준fm 96.5Mhz ","TBC 파워 FM 99.3Mhz",
"KBS 1라디오 101.3Mhz : ","kbs 대구 해피 fm 102.3Mhz","도로교통공단 대구방송 103.9Mhz","ebs fm 105.1Mhz"
};
char lcs_tbl[8][10]={"89.7MHz","95.3Mhz","96.5Mhz","99.3Mhz","101.3Mhz","102.3Mhz","103.9Mhz","105.1Mhz"};
char s[12];
//
void setup(){
lcd.begin(16,2); lcd.clear();
Serial.begin(57600); Serial.println("Radio...");
delay(200);
radio.init(); radio.debugEnable(); radio.setVolume(2); radio.setMono(false);
}
//
void loop(){
int val=analogRead(A0)>>7;
//
if(mode!=val){ mode=val;
int FIX_STATION=station_tbl[mode]; radio.setBandFrequency(FIX_BAND,FIX_STATION);
Serial.print(serial_tbl[mode]); Serial.println(mode);
lcd.print(lcs_tbl[mode]);
radio.formatFrequency(s,sizeof(s));
Serial.print("Station:"); Serial.println(s);
Serial.print("Radio:"); //radio.debugRadioInfo();
Serial.print("Audio:"); radio.debugAudioInfo();
}
}
컴파일 해본 것은 아니니 오류가 발생하면 수정해서 사용하세요
댓글 1
조회수 748장사월포님의 댓글
장사월포 작성일감사합니다. 많이 배웁니다!