마무리만 하면 되는 상황에서 고민을 많이 했습니다만
중단하기로 했습니다.
캐패시터 스폿 자체에는 전혀 문제가 없습니다.
문제는 제가 계획중인 프로젝트 중에
스텐레스 박판이나 강철 와이어의 스폿용접이 필요할 수도 있다는거죠.
캐패시터 스폿은 순간적으로 빠른 전압 강하가 일어나기 때문인지
다른 용도의 스폿에는 사용하기가 힘들더군요.
2번이나 제작한 캐패시터 PCB 뭉치를 포기하려니 아까운 마음에 고민을 했습니다만
과감하게 중단하고 다시 AC 스폿기로 돌아가야 할 것 같습니다.
#include <EEPROM.h>
#include <Encoder.h> // https://github.com/PaulStoffregen/Encoder
#include <U8glib.h>
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0);
//이하 핀 선언
#define encoderA 2 //엔코더 A상 - interrupt of arduino nano
#define encoderB 3 //엔코더 B상 - interrupt of arduino nano
#define encoderSW 4 //엔코더스위치
#define spotSignal 5 //스폿 출력
#define piezo 6 //피에조 출력
#define spotSW 7 //스폿 트리거 스위치
#define FanControl 13 //팬 출력. pwm체크할것.
#define VoltagePin A0 //전압체크 입력
#define tempPin A1 //온도센서 입력
#define autoSpotCheckPin A2 //오토스폿 체크 입력
//이하 음계 주파수 선언
#define B7 3951
#define C8 4186
//이하 변수 선언
float voltage; //전압
boolean manualMode = true; // 수동/자동 모드 선택
boolean dualMode = false; //듀얼모드 선택
float spotTime= 0.1; // 스폿 시간
boolean spotFlag = false; //스폿이 실행됐는지 아닌지 저장하는 플래그.
double intervalTime = 1.5; //오토모드시 인터벌 타임
float dualTime = 0.5; //듀얼모드시 듀얼 타임
unsigned long currentTime; //인터벌 시간을 측정하기 위해 millis()를 저장하는 변수
unsigned long previousTime; //인터벌 시간을 측정하기 위해 millis()를 저장하는 변수
char voltageChar[4];
char temperatureChar[4];
char spotTimeChar[4];
char intervalTimeChar[4];
char dualTimeChar[4];
//EEPROM 관련 변수 선언
int spotTimeAddress = 0;
int autoTimeAddress = 10;
int menuSelect = 0; //화면에서 선택된 메뉴를 구분하는 변수. 0=수폿시간, 1=자동/수동 선택 2=인터벌, 3=듀얼모드, 4=듀얼시간,
//온도관련 변수 선언
#define thermistorR 10000 //써미스터 저항값
#define Coefficient 3950 //써미스터 계수
#define tempNorm 25 //보통 실온의 온도
#define resistorR 10000 //병렬저항의 저항값
#define numSamples 3 //평균을 몇 번 낼 것인가
uint16_t samples[numSamples];
float temperature, average; //온도, 평균온도
//엔코더 관련 플래그 변수 선언
boolean encoderFlagUp; //엔코더에서 들어온 UP 신호 플래그(UP 행동후 false 전환)
boolean encoderFlagDown; //엔코더에서 들어온 DOWN 신호 플래그(DOWN 행동후 false전환)
boolean SWpressedFlag = false; //스위치가 눌렸는지 저장하는 플래그 변수
int oldPosition = 0;
Encoder myEncoder(encoderA, encoderB);
const uint8_t PROGMEM boot[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x00,0x78,0x03,0xfe,0x00,
0x00,0x7f,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0x80,0x7c,0x03,0xff,0x00,
0x00,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0x80,0xfc,0x03,0xff,0x80,
0x00,0xf0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x81,0x80,0xfc,0x03,0xc3,0x80,
0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x00,0x00,0xfe,0x03,0xc3,0xc0,
0x00,0xe0,0x03,0x83,0x87,0x7c,0x01,0xf0,0x3b,0x9e,0x00,0x01,0xee,0x03,0xc3,0xc0,
0x00,0xf0,0x03,0x83,0x87,0xfe,0x07,0xf8,0x3f,0x9c,0x00,0x01,0xcf,0x03,0xc3,0xc0,
0x00,0x7c,0x03,0x83,0x87,0xff,0x0f,0xfc,0x3f,0x9c,0x00,0x03,0xcf,0x03,0xc7,0x80,
0x00,0x3e,0x03,0x83,0x87,0x8f,0x0f,0x1c,0x3c,0x3c,0x00,0x03,0xc7,0x03,0xff,0x80,
0x00,0x1f,0x83,0x83,0x87,0x87,0x9e,0x1e,0x3c,0x3c,0x00,0x07,0x87,0x83,0xff,0x00,
0x00,0x07,0xc3,0x83,0x87,0x07,0x9f,0xfe,0x38,0x1c,0x00,0x07,0x83,0x83,0xfc,0x00,
0x00,0x03,0xc3,0x83,0x87,0x03,0x9f,0xfe,0x38,0x1c,0x00,0x07,0xff,0xc3,0xc0,0x00,
0x00,0x01,0xe3,0x83,0x87,0x03,0x9f,0xfe,0x38,0x1e,0x00,0x0f,0xff,0xc3,0xc0,0x00,
0x00,0x01,0xe3,0x83,0x87,0x07,0x9e,0x00,0x38,0x0f,0x00,0x0f,0xff,0xe3,0xc0,0x00,
0x00,0x83,0xc3,0xc7,0x87,0x07,0x8f,0x0c,0x38,0x0f,0xc1,0x1e,0x01,0xe3,0xc0,0x00,
0x00,0xff,0xc3,0xff,0x87,0x8f,0x0f,0xfc,0x38,0x07,0xff,0x9e,0x00,0xe3,0xc0,0x00,
0x00,0xff,0x81,0xff,0x87,0xff,0x07,0xfc,0x38,0x03,0xff,0xbc,0x00,0xf3,0xc0,0x00,
0x00,0x7e,0x00,0xfb,0x87,0xfe,0x01,0xf8,0x38,0x00,0x7e,0x3c,0x00,0x73,0xc0,0x00,
0x00,0x00,0x00,0x00,0x07,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xff,0xff,0x00,0x0f,0xf0,0x00,0x00,0x07,0x80,0x00,0x07,0x80,
0x00,0x00,0x00,0x00,0xff,0xff,0x00,0x7f,0xfc,0x01,0xff,0x87,0x80,0x00,0x07,0x80,
0x00,0x03,0x80,0x00,0xff,0xff,0x00,0xff,0xfe,0x01,0xff,0x87,0x83,0xff,0xc7,0x80,
0x00,0x03,0x80,0x00,0x3c,0x38,0x00,0xf0,0x1f,0x01,0xff,0x87,0x83,0xff,0xc7,0x80,
0x00,0x07,0x80,0x00,0x3c,0x38,0x00,0xe0,0x0f,0x00,0x07,0x87,0x81,0xff,0xc7,0x80,
0x00,0x07,0xc0,0x00,0x3c,0x38,0x00,0xf0,0x1f,0x00,0x0f,0x7f,0x80,0x03,0xc7,0x80,
0x00,0x0f,0xe0,0x01,0xff,0xff,0x00,0xff,0xfe,0x00,0x1f,0x7f,0x80,0x03,0xc7,0x80,
0x00,0x0f,0xe0,0x01,0xff,0xff,0x00,0x7f,0xfc,0x00,0x1e,0x7f,0x80,0x03,0x87,0x80,
0x00,0x1e,0xf0,0x01,0xff,0xff,0x00,0x3f,0xf8,0x00,0x7f,0x07,0x80,0x03,0x87,0x80,
0x00,0x7e,0x7c,0x00,0x03,0x80,0x00,0x38,0x38,0x00,0xff,0xc7,0x80,0x07,0x87,0x80,
0x01,0xfc,0x3f,0x00,0x03,0x80,0x00,0x38,0x38,0x01,0xfb,0xf7,0x80,0x0f,0x07,0x80,
0x03,0xf0,0x1f,0x8f,0xff,0xff,0xef,0xff,0xff,0xe7,0xe1,0xe7,0x80,0x0f,0x07,0x80,
0x03,0xe0,0x0f,0x8f,0xff,0xff,0xef,0xff,0xff,0xe3,0xc0,0x47,0x80,0x1e,0x07,0x80,
0x01,0x80,0x03,0x0f,0xff,0xff,0xef,0xff,0xff,0xe3,0x00,0x00,0x00,0x3c,0x07,0x80,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x07,0x80,0xf8,0x07,0x80,
0x00,0x00,0x00,0x00,0x03,0x80,0x00,0x0f,0xf0,0x00,0x38,0x07,0x81,0xf0,0x07,0x80,
0x00,0x00,0x00,0x00,0x03,0x80,0x00,0x7f,0xfc,0x00,0x3f,0xff,0x87,0xe0,0x07,0x80,
0x0f,0xff,0xff,0xe0,0x07,0xc0,0x00,0xff,0xfe,0x00,0x3f,0xff,0x83,0xc0,0x07,0x80,
0x0f,0xff,0xff,0xe0,0x07,0xc0,0x00,0xf0,0x1f,0x00,0x3f,0xff,0x81,0x80,0x07,0x80,
0x0f,0xff,0xff,0xe0,0x1f,0xf0,0x00,0xe0,0x0f,0x00,0x38,0x07,0x80,0x00,0x07,0x80,
0x00,0x00,0x00,0x00,0x7e,0x7e,0x00,0xf0,0x1f,0x00,0x38,0x07,0x80,0x00,0x07,0x80,
0x00,0x00,0x00,0x03,0xf8,0x3f,0x80,0xff,0xfe,0x00,0x3f,0xff,0x80,0x00,0x07,0x80,
0x00,0x00,0x00,0x01,0xf0,0x1f,0x80,0x7f,0xfc,0x00,0x3f,0xff,0x80,0x00,0x07,0x80,
0x00,0x00,0x00,0x01,0x80,0x03,0x00,0x0f,0xf0,0x00,0x3f,0xff,0x00,0x00,0x07,0x80,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
//수동
const unsigned char PROGMEM manual[] = {
0x00,0x00,0x00,
0x00,0x0e,0x00,
0x00,0x0e,0x00,
0x00,0x0e,0x00,
0x00,0x1e,0x00,
0x00,0x3f,0x80,
0x00,0xf3,0xe0,
0x07,0xe0,0xf0,
0x07,0x80,0x30,
0x00,0x00,0x00,
0x00,0x00,0x00,
0x1f,0xff,0xfc,
0x1f,0xff,0xfc,
0x00,0x0c,0x00,
0x00,0x0c,0x00,
0x00,0x0c,0x00,
0x00,0x0c,0x00,
0x00,0x0c,0x00,
0x00,0x0c,0x00,
0x00,0x0c,0x00,
0x00,0x00,0x00,
0x00,0x00,0x00,
0x03,0xff,0xe0,
0x03,0xff,0xe0,
0x01,0x80,0x00,
0x01,0x80,0x00,
0x01,0xff,0xe0,
0x01,0xff,0xe0,
0x00,0x0c,0x00,
0x00,0x0c,0x00,
0x1f,0xff,0xfc,
0x1f,0xff,0xfc,
0x00,0x00,0x00,
0x00,0x00,0x00,
0x00,0x7f,0x80,
0x00,0xff,0xc0,
0x01,0xc0,0xe0,
0x01,0x80,0x60,
0x01,0xc0,0xe0,
0x00,0xff,0xc0,
0x00,0x7f,0x80
};
//자동
const unsigned char PROGMEM automatic[] = {
0x00,0x00,0xe0,
0x00,0x00,0xe0,
0x00,0x00,0x60,
0x0f,0xfc,0x60,
0x0f,0xfc,0x60,
0x00,0x18,0x60,
0x00,0x38,0x60,
0x00,0x30,0x60,
0x00,0x70,0x60,
0x00,0xf0,0x7e,
0x01,0xf8,0x7e,
0x03,0x9c,0x60,
0x07,0x0e,0x60,
0x1e,0x07,0x60,
0x1c,0x03,0x60,
0x00,0x00,0x60,
0x00,0x00,0x60,
0x00,0x00,0x60,
0x00,0x00,0x60,
0x00,0x00,0x60,
0x00,0x00,0x00,
0x00,0x00,0x00,
0x03,0xff,0xe0,
0x03,0xff,0xe0,
0x01,0x80,0x00,
0x01,0x80,0x00,
0x01,0xff,0xe0,
0x01,0xff,0xe0,
0x00,0x0c,0x00,
0x00,0x0c,0x00,
0x1f,0xff,0xfc,
0x1f,0xff,0xfc,
0x00,0x00,0x00,
0x00,0x00,0x00,
0x00,0x7f,0x80,
0x00,0xff,0xc0,
0x01,0xc0,0xe0,
0x01,0x80,0x60,
0x01,0xc0,0xe0,
0x00,0xff,0xc0,
0x00,0x7f,0x80
};
void u8g_prepare() {
u8g.setFont(u8g_font_7x13B); //
u8g.setFontRefHeightExtendedText();
u8g.setDefaultForegroundColor();
u8g.setFontPosTop();
}
void setup() {
pinMode(encoderSW, INPUT);
pinMode(encoderA, INPUT);
pinMode(encoderB, INPUT);
pinMode(spotSignal, OUTPUT);
pinMode(piezo, OUTPUT);
pinMode(spotSW, INPUT_PULLUP);
pinMode(autoSpotCheckPin, INPUT);
pinMode(FanControl, OUTPUT);
pinMode(VoltagePin, INPUT);
pinMode(tempPin, INPUT);
u8g_prepare();
u8g.firstPage(); //두번째 로고를 그린다.
do {
// drawBitmapP(X,Y,Count,H) 에서 count는 비트맵의 가로픽셀수/8, H는 세로픽셀수 이다.
u8g.drawBitmapP( 0, 0, 16, 64, boot);
}
while( u8g.nextPage() ) ;
delay(100);
previousTime = millis();
beepbeep();
//Serial.begin(9600);
//spotTime = EEPROM.read(spotTimeAddress);
//autoTime = EEPROM.read(autoTimeAddress);
}
void loop() {
//전압 체크
voltage = analogRead(VoltagePin);
voltage = voltage *(5.0/1024.0)*5.3; //입력 아날로그값(1024)를 5V 수치로 변환시킨 후 전압분배 저항값만큼(5.3)곱한다
//온도 체크
for (int i = 0; i<numSamples; i++){
samples[i] = analogRead(tempPin);
}
average = 0;
for (int i = 0; i<numSamples; i++){
average += samples[i];
}
average /= numSamples;
average = 1023 / average - 1;
average = resistorR / average;
temperature = average / thermistorR; // (R/Ro)
temperature = log(temperature); //ln(R/Ro)
temperature /= Coefficient; //1/B * ln(R/Ro)
temperature += 1.0 / (tempNorm + 273.15); // + (1/To)
temperature = 1.0 / temperature; // Invert
temperature -= 273.15; // convert to C
//소수점 이하 자리를 2 단위로 끊기 위한 계산처리
temperature *= 5;
temperature = round(temperature);
temperature /= 5;
//이하 엔코더 입력 처리
if(digitalRead(encoderSW)==HIGH){ //스위치가 눌리면 일단 기억한다.
SWpressedFlag = true;
}
if(digitalRead(encoderSW)==LOW && SWpressedFlag==true){ //스위치가 안 눌리면, 눌렸는지 확인하고 그렇다면 아래 구문을 실행
menuSelect++; //스위치가 눌리면 스폿시간, 자동/수동 선택, 인터벌 시간 등을 돌아가며 선택한다
if((menuSelect==4)&&(dualMode==false)){
menuSelect = 0;
}
if(menuSelect>4){
menuSelect = 0;
}
beep();
SWpressedFlag = false;
}
readEncoder();
if(encoderFlagUp==true){ //상승 트리거 선택시
switch (menuSelect) {
case 0: //0=스폿시간, 3=듀얼모드, 4=듀얼시간,
if(spotTime<10){
spotTime= spotTime+0.5;
}
else{
spotTime++;
}
break;
case 1: //1=자동/수동 선택
manualMode =! manualMode;
break;
case 2: //2=인터벌 시간 조정
intervalTime = intervalTime+0.1;
if(intervalTime>5){ //인터벌 시간이 5초를 넘지 않도록 설정.
intervalTime = 5;
}
break;
case 3: //3=듀얼/싱글모드 선택
dualMode =! dualMode;
break;
case 4: //4=듀얼일 경우 시간 조정
if(dualMode==true){
dualTime = dualTime + 0.5;
}
}
beep();
encoderFlagUp = false;
}
if(encoderFlagDown==true){ //하강 트리거 선택시
switch (menuSelect) {
case 0: //0=스폿시간
if(spotTime<10){
spotTime= spotTime - 0.5;
}
else{
spotTime--;
}
break;
case 1: //1=자동/수동 선택
manualMode =! manualMode;
break;
case 2: //2=인터벌 시간 조정
intervalTime = intervalTime - 0.1;
if(intervalTime<0.5){ //인터벌 시간이 0.5초 이하가 되지 않도록 설정.
intervalTime = 0.5;
}
break;
case 3: //3=듀얼/싱글모드 선택
dualMode =! dualMode;
break;
case 4: //듀얼일 경우 듀얼 시간 조정
if(dualMode==true){
dualTime = dualTime - 0.5;
}
}
encoderFlagDown = false;
beep();
}
if(spotTime<0.5){ //스폿 시간이 0이 되지 않도록 처리
beepbeep();
spotTime = 0.5;
}
if(manualMode == true){ //수동 모드일 때
if((digitalRead(spotSW)==LOW) && (spotFlag==false)){ //스폿 스위치가 눌리면 스폿한다.
currentTime = millis();
if(currentTime > (previousTime + (intervalTime*1000))){
spot();
}
}
if(digitalRead(spotSW)==HIGH){
spotFlag = false;
}
}
else if((analogRead(autoSpotCheckPin)>400) && (spotFlag==false)){ //자동 모드일 때 A2핀에 2/5 이상의 전압이 걸리면
delay(intervalTime*1000); //인터벌 시간 후 스폿
currentTime = millis();
if(currentTime > (previousTime + (intervalTime*1000))){
spot();
}
}
if(digitalRead(spotSW)==HIGH){
spotFlag = false;
}
draw(); //OLED 그리는 함수 호출
}
void readEncoder(){ //엔코더를 오른쪽으로 돌리는 것을 UP으로 설정한다.
int newPosition = myEncoder.read();
if ((newPosition+1) < oldPosition) { //값의 변화가 생기면 오른 값인지 내린 값인지 비교하여 Flag 설정.
encoderFlagUp = true; // +1 과 -1을 해주는 이유는 분해능 때문에 3번씩 반복되는것을 막기 위함
}
if ((newPosition-1) > oldPosition) {
encoderFlagDown = true;
}
oldPosition = newPosition;
if(oldPosition > 32760 || oldPosition < -32760){
oldPosition = 0; //int 변수의 범위를 벗어나지 않도록 고정.
}
}
void draw(){
u8g.firstPage(); //화면에 기본 정보 표시
do {
//수동/자동 글자 표시
if(manualMode == true){ //수동일 경우-수동 선택 표시
u8g.drawBitmapP( 0, 20, 3, 41, manual);
}
else{ //자동일 경우
u8g.drawBitmapP( 0, 20, 3, 41, automatic);
}
//구분선 표시
u8g.drawLine(0, 0, 128, 0);
u8g.drawLine(0, 14, 128, 14);
//전압표시
dtostrf(voltage,2,1,voltageChar);
u8g.drawStr(5,2,voltageChar);
if(voltage<10){
u8g.drawStr(30,2,"V");
}
else{
u8g.drawStr(38,2,"V");
}
//온도표시
dtostrf(temperature,2,1,temperatureChar);
u8g.drawStr(73,2,temperatureChar);
u8g.drawStr(103,2,"'C");
//스폿시간 표시
u8g.setScale2x2();
if(spotTime<10){ //스폿시간이 10보다 작으면 위치를 조정
dtostrf(spotTime,2,1,spotTimeChar);
u8g.drawStr(23, 19, spotTimeChar);
u8g.drawStr(45, 19, "ms");
}
else{ //10보다 크면 위치를 조정.
dtostrf(spotTime,2,0,spotTimeChar);
u8g.drawStr(27, 19, spotTimeChar);
u8g.drawStr(43, 19, "ms");
}
u8g.undoScale();
//인터벌 시간 표시
u8g.drawStr(32, 21, "I");
dtostrf(intervalTime, 2, 1, intervalTimeChar);
u8g.drawStr(43, 21, intervalTimeChar);
u8g.drawStr(65, 21, "s");
//듀얼시간 표시
if(dualMode == true){
u8g.drawStr(80, 21, "D");
}
else{
u8g.drawStr(80, 21, "S");
}
dtostrf(dualTime, 2, 1, dualTimeChar);
u8g.drawStr(91,21, dualTimeChar);
u8g.drawStr(113, 21, "ms");
//선택된 부분에 사각형 표시
switch (menuSelect) { //0=스폿시간, //1=자동/수동 선택 2=인터벌, 3=듀얼모드, 4=듀얼시간,
case 0:
u8g.drawRFrame(35, 35, 92, 29, 4); //스폿시간
break;
case 1:
u8g.drawRFrame(0, 18, 25, 46, 3); //수동/자동
break;
case 2:
u8g.drawRFrame(28, 18, 47, 17, 3); //인터벌
break;
case 3:
u8g.drawRFrame(76, 18, 13, 17, 2); //듀얼모드/싱글모드
break;
case 4:
u8g.drawRFrame(88, 18, 40, 17, 3); //듀얼일 경우 듀얼 시간
break;
}
//u8g.drawRFrame(20, 40, 20, 20, 3); //시작점(왼쪽 위)의 X좌표, Y좌표, 박스의 폭, 박스의 높이, R값
}
while( u8g.nextPage() ) ;
}
void spot(){
spotFlag = true;
digitalWrite(spotSignal, HIGH);
delayMicroseconds(spotTime*1000);
digitalWrite(spotSignal, LOW);
if(dualMode==true){
delayMicroseconds(dualTime*1000);
digitalWrite(spotSignal, HIGH);
delayMicroseconds(spotTime*1000);
digitalWrite(spotSignal, LOW);
beep();
}
beep();
previousTime = currentTime;
}
void beepbeep(){
tone(piezo, B7, 50);
delay(100);
tone(piezo, B7, 50);
delay(100);
}
void beep(){
tone(piezo, C8, 30);
delay(40);
}