let Refresh_Time = 0
let min = 0
let Refresh_Temp = 0
let hour = 0
input.onButtonPressed(Button.A, () => {
hour += 1
})
input.onButtonPressed(Button.B, () => {
min += 1
})
Refresh_Temp = input.temperature() * 9 / 5 + 32
Refresh_Time = min
LCD1IN8.LCD_Init()
LCD1IN8.LCD_SetBL(330)
LCD1IN8.LCD_Display()
LCD1IN8.LCD_Clear()
basic.forever(() => {
LCD1IN8.DisNumber(
32,
50,
input.temperature() * 9 / 5 + 32,
LCD1IN8.Get_Color(LCD_COLOR.RED)
)
LCD1IN8.DisString(
50,
50,
"F",
LCD1IN8.Get_Color(LCD_COLOR.RED)
)
LCD1IN8.DisNumber(
32,
60,
input.temperature(),
LCD1IN8.Get_Color(LCD_COLOR.BLUE)
)
LCD1IN8.DisString(
50,
60,
"C",
LCD1IN8.Get_Color(LCD_COLOR.BLUE)
)
LCD1IN8.LCD_Display()
})
basic.forever(() => {
LCD1IN8.DisNumber(
53,
32,
min,
LCD1IN8.Get_Color(LCD_COLOR.BLACK)
)
LCD1IN8.DisString(
42,
32,
":",
LCD1IN8.Get_Color(LCD_COLOR.BLACK)
)
LCD1IN8.DisNumber(
26,
32,
hour,
LCD1IN8.Get_Color(LCD_COLOR.BLACK)
)
})
basic.forever(() => {
if ((hour == 12 && min) == 60) {
hour = 1
min = 0
}
if (min == 60) {
min = 0
hour += 1
}
})
basic.forever(() => {
if (Refresh_Time != min) {
Refresh_Time = min
LCD1IN8.LCD_Clear()
}
if (Refresh_Temp != input.temperature() * 9 / 5 + 32) {
Refresh_Temp = input.temperature() * 9 / 5 + 32
LCD1IN8.LCD_Clear()
}
})
basic.forever(() => {
basic.pause(60000)
min += 1
})
Comments