Browse Source

Modifications

master
Ruel Tmeizeh 8 years ago
parent
commit
c4aa686732
1 changed files with 18 additions and 12 deletions
  1. +18
    -12
      sweeperino_lcd.ino

+ 18
- 12
sweeperino_lcd.ino View File

@ -6,28 +6,30 @@
#include <LiquidCrystal.h> #include <LiquidCrystal.h>
#include <Rotary.h> #include <Rotary.h>
/*
//Use these 2 lines if you want to use a little OLED display.
#include <ssd1306_tiny.h>
ssd1306_tiny display;
*/
Rotary r = Rotary(3,2); // sets the pins the rotary encoder uses. Must be interrupt pins. Rotary r = Rotary(3,2); // sets the pins the rotary encoder uses. Must be interrupt pins.
LiquidCrystal lcd(12, 11, 7,8,9,10);
LiquidCrystal lcd(12,11, 7,8,9,10);
long stepInterval = 1000; long stepInterval = 1000;
uint8_t buttonPressed = 1; uint8_t buttonPressed = 1;
/* #include <ssd1306_tiny.h>
ssd1306_tiny display; */
Si5351 si5351; Si5351 si5351;
Si570 *si570=NULL; Si570 *si570=NULL;
#define SI570_I2C_ADDRESS 0x55 #define SI570_I2C_ADDRESS 0x55
char printBuff[20]; char printBuff[20];
#define LOG_AMP A3 #define LOG_AMP A3
//#define WB_POWER_CALIBERATION (-112)
//#define WB_POWER_CALIBERATION (-112) //Set your power calibration here
#define WB_POWER_CALIBERATION (-92) #define WB_POWER_CALIBERATION (-92)
#define BUTTON 4 #define BUTTON 4
#define BUTTON2 5
#define BUTTON2 5 //future use maybe
int dbm_reading = 100; int dbm_reading = 100;
int mw_reading = 0; int mw_reading = 0;
@ -54,7 +56,7 @@ void setup()
PCMSK2 |= (1 << PCINT18) | (1 << PCINT19); PCMSK2 |= (1 << PCINT18) | (1 << PCINT19);
sei(); sei();
pinMode(4,INPUT_PULLUP);
pinMode(BUTTON,INPUT_PULLUP); //set button input to pullup mode
lcd.begin(16, 2); lcd.begin(16, 2);
printBuff[0] = 0; printBuff[0] = 0;
@ -88,7 +90,7 @@ void setup()
printLine2("Si570 ON"); printLine2("Si570 ON");
} }
setFrequency(14100000);
setFrequency(14100000); //14.1MHz initial frequency
previous = analogRead(TUNING)/2; previous = analogRead(TUNING)/2;
} }
@ -282,6 +284,8 @@ void doTuning(){
} }
//Main program loop:
void loop(){ void loop(){
if (Serial.available()>0) if (Serial.available()>0)
acceptCommand(); acceptCommand();
@ -291,7 +295,7 @@ void loop(){
doTuning(); doTuning();
} }
buttonPressed = digitalRead(4);
buttonPressed = digitalRead(BUTTON);
if (buttonPressed) { if (buttonPressed) {
lcd.clear(); lcd.clear();
lcd.setCursor(0,0); lcd.setCursor(0,0);
@ -306,7 +310,9 @@ void loop(){
} }
ISR(PCINT2_vect) {
//Interrupt processing.
//This is probably kindof messy, but it works...
ISR(PCINT2_vect) {
unsigned char result = r.process(); unsigned char result = r.process();
if (result == DIR_NONE) { if (result == DIR_NONE) {
// do nothing // do nothing


Loading…
Cancel
Save