Here is an attempt to post my project. Note that the issue (as I see it) seems to be under the function “show_clock_indicators”, where I have a [set “Housenumber_hours” to (Read “Hours” as Number)] and after that a condition [If “Housenumber_hours” is equal to “Housenumber_ON_time” then…] :
enum RadioMessage {
message1 = 49434,
On = 43154,
Mode_1 = 23411,
Mode_2 = 56276,
Mode_3 = 15758,
Mode_4 = 25688,
Mode_5 = 2665,
Mode_6 = 54001,
Mode_0 = 10458
}
function Hour_indicators () {
if (light_intensity <= 2) {
light_intensity_hours = 2
} else {
light_intensity_hours = light_intensity / 2
}
haloDisplay.setZipLedColor(0, kitronik_halo_hd.rgb(light_intensity_hours, 0, light_intensity_hours))
haloDisplay.setZipLedColor(5, kitronik_halo_hd.rgb(light_intensity_hours, 0, light_intensity_hours))
haloDisplay.setZipLedColor(10, kitronik_halo_hd.rgb(light_intensity_hours, 0, light_intensity_hours))
haloDisplay.setZipLedColor(15, kitronik_halo_hd.rgb(light_intensity_hours, 0, light_intensity_hours))
haloDisplay.setZipLedColor(20, kitronik_halo_hd.rgb(light_intensity_hours, 0, light_intensity_hours))
haloDisplay.setZipLedColor(25, kitronik_halo_hd.rgb(light_intensity_hours, 0, light_intensity_hours))
haloDisplay.setZipLedColor(30, kitronik_halo_hd.rgb(light_intensity_hours, 0, light_intensity_hours))
haloDisplay.setZipLedColor(35, kitronik_halo_hd.rgb(light_intensity_hours, 0, light_intensity_hours))
haloDisplay.setZipLedColor(40, kitronik_halo_hd.rgb(light_intensity_hours, 0, light_intensity_hours))
haloDisplay.setZipLedColor(45, kitronik_halo_hd.rgb(light_intensity_hours, 0, light_intensity_hours))
haloDisplay.setZipLedColor(50, kitronik_halo_hd.rgb(light_intensity_hours, 0, light_intensity_hours))
haloDisplay.setZipLedColor(55, kitronik_halo_hd.rgb(light_intensity_hours, 0, light_intensity_hours))
}
function set_clock_hours () {
while (setting_clock_time == 1) {
haloDisplay.clear()
haloDisplay.setZipLedColor(kitronik_halo_hd.readTimeForZip(TimeParameter.Hours), kitronik_halo_hd.rgb(light_intensity, 0, 0))
haloDisplay.setZipLedColor(kitronik_halo_hd.readTimeForZip(TimeParameter.Minutes), kitronik_halo_hd.rgb(0, 0, 0))
haloDisplay.setZipLedColor(kitronik_halo_hd.readTimeForZip(TimeParameter.Seconds), kitronik_halo_hd.rgb(0, 0, 0))
haloDisplay.show()
if (input.buttonIsPressed(Button.AB)) {
setting_clock_time = 2
} else if (input.buttonIsPressed(Button.A)) {
kitronik_halo_hd.writeHours(kitronik_halo_hd.readTimeParameter(TimeParameter.Hours) + 1)
} else if (input.buttonIsPressed(Button.B)) {
kitronik_halo_hd.writeHours(kitronik_halo_hd.readTimeParameter(TimeParameter.Hours) - 1)
}
basic.pause(250)
haloDisplay.setZipLedColor(kitronik_halo_hd.readTimeForZip(TimeParameter.Hours), kitronik_halo_hd.rgb(0, 0, 0))
haloDisplay.show()
if (input.buttonIsPressed(Button.AB)) {
setting_clock_time = 2
} else if (input.buttonIsPressed(Button.A)) {
kitronik_halo_hd.writeHours(kitronik_halo_hd.readTimeParameter(TimeParameter.Hours) + 1)
} else if (input.buttonIsPressed(Button.B)) {
kitronik_halo_hd.writeHours(kitronik_halo_hd.readTimeParameter(TimeParameter.Hours) - 1)
}
basic.pause(250)
}
haloDisplay.showRainbow(1, 360)
haloDisplay.show()
while (input.buttonIsPressed(Button.AB)) {
basic.pause(25)
haloDisplay.rotate(1)
haloDisplay.show()
}
for (let index = 0; index < 40; index++) {
basic.pause(25)
haloDisplay.rotate(1)
haloDisplay.show()
}
haloDisplay.setZipLedColor(kitronik_halo_hd.readTimeForZip(TimeParameter.Hours), kitronik_halo_hd.rgb(light_intensity, 0, 0))
haloDisplay.show()
music.playTone(698, music.beat(BeatFraction.Eighth))
set_clock_minutes()
}
function set_clock_minutes () {
while (setting_clock_time == 2) {
haloDisplay.clear()
haloDisplay.setZipLedColor(kitronik_halo_hd.readTimeForZip(TimeParameter.Hours), kitronik_halo_hd.rgb(0, 0, 0))
haloDisplay.setZipLedColor(kitronik_halo_hd.readTimeForZip(TimeParameter.Minutes), kitronik_halo_hd.rgb(0, light_intensity, 0))
haloDisplay.setZipLedColor(kitronik_halo_hd.readTimeForZip(TimeParameter.Seconds), kitronik_halo_hd.rgb(0, 0, 0))
haloDisplay.show()
if (input.buttonIsPressed(Button.AB)) {
setting_clock_time = 3
} else if (input.buttonIsPressed(Button.A)) {
kitronik_halo_hd.writeMinutes(kitronik_halo_hd.readTimeParameter(TimeParameter.Minutes) + 1)
} else if (input.buttonIsPressed(Button.B)) {
kitronik_halo_hd.writeMinutes(kitronik_halo_hd.readTimeParameter(TimeParameter.Minutes) - 1)
}
basic.pause(250)
haloDisplay.setZipLedColor(kitronik_halo_hd.readTimeForZip(TimeParameter.Minutes), kitronik_halo_hd.rgb(0, 0, 0))
haloDisplay.show()
if (input.buttonIsPressed(Button.AB)) {
setting_clock_time = 3
} else if (input.buttonIsPressed(Button.A)) {
kitronik_halo_hd.writeMinutes(kitronik_halo_hd.readTimeParameter(TimeParameter.Minutes) + 1)
} else if (input.buttonIsPressed(Button.B)) {
kitronik_halo_hd.writeMinutes(kitronik_halo_hd.readTimeParameter(TimeParameter.Minutes) - 1)
}
basic.pause(250)
}
haloDisplay.showRainbow(1, 360)
haloDisplay.show()
while (input.buttonIsPressed(Button.AB)) {
basic.pause(25)
haloDisplay.rotate(1)
haloDisplay.show()
}
for (let index = 0; index < 40; index++) {
basic.pause(25)
haloDisplay.rotate(1)
haloDisplay.show()
}
haloDisplay.setZipLedColor(kitronik_halo_hd.readTimeForZip(TimeParameter.Minutes), kitronik_halo_hd.rgb(0, light_intensity, 0))
haloDisplay.show()
music.startMelody(music.builtInMelody(Melodies.PowerUp), MelodyOptions.Once)
Tx_housenumber_MODE()
}
function Tx_housenumber_MODE () {
haloDisplay.clear()
basic.showIcon(IconNames.SmallHeart)
music.playTone(131, music.beat(BeatFraction.Half))
while (setting_clock_time == 3) {
haloDisplay.clear()
haloDisplay.setZipLedColor(Housenumber_MODE, kitronik_halo_hd.rgb(0, light_intensity, light_intensity))
haloDisplay.show()
if (input.buttonIsPressed(Button.AB)) {
while (input.buttonIsPressed(Button.AB)) {
}
setting_clock_time = 0
} else if (input.buttonIsPressed(Button.A)) {
while (input.buttonIsPressed(Button.A)) {
}
if (Housenumber_MODE > 0) {
Housenumber_MODE = Housenumber_MODE - 1
} else {
Housenumber_MODE = 6
}
} else if (input.buttonIsPressed(Button.B)) {
while (input.buttonIsPressed(Button.B)) {
}
if (Housenumber_MODE < 6) {
Housenumber_MODE = Housenumber_MODE + 1
} else {
Housenumber_MODE = 0
}
}
basic.showNumber(Housenumber_MODE)
}
basic.clearScreen()
music.playTone(988, music.beat(BeatFraction.Half))
show_clock_indicators()
}
function indicating_setting_clock () {
music.startMelody(music.builtInMelody(Melodies.BaDing), MelodyOptions.Once)
haloDisplay.showRainbow(1, 360)
haloDisplay.show()
for (let index = 0; index < 120; index++) {
basic.pause(25)
haloDisplay.rotate(1)
haloDisplay.show()
}
haloDisplay.clear()
set_clock_hours()
}
function Tx_housenumber_control () {
Housenumber_is_ON = 1
radio.sendMessage(RadioMessage.On)
if (Housenumber_MODE == 1) {
radio.sendMessage(RadioMessage.Mode_1)
} else if (Housenumber_MODE == 2) {
radio.sendMessage(RadioMessage.Mode_2)
} else if (Housenumber_MODE == 3) {
radio.sendMessage(RadioMessage.Mode_3)
} else if (Housenumber_MODE == 4) {
radio.sendMessage(RadioMessage.Mode_4)
} else if (Housenumber_MODE == 5) {
radio.sendMessage(RadioMessage.Mode_5)
} else if (Housenumber_MODE == 6) {
radio.sendMessage(RadioMessage.Mode_6)
} else {
radio.sendMessage(RadioMessage.Mode_0)
}
}
function show_clock_indicators () {
while (setting_clock_time == 0) {
haloDisplay.clear()
Hour_indicators()
haloDisplay.setZipLedColor(kitronik_halo_hd.readTimeForZip(TimeParameter.Hours), kitronik_halo_hd.rgb(light_intensity, 0, 0))
haloDisplay.setZipLedColor(kitronik_halo_hd.readTimeForZip(TimeParameter.Minutes), kitronik_halo_hd.rgb(0, light_intensity, 0))
haloDisplay.setZipLedColor(kitronik_halo_hd.readTimeForZip(TimeParameter.Seconds), kitronik_halo_hd.rgb(0, 0, light_intensity))
haloDisplay.show()
Housenumber_hours = kitronik_halo_hd.readTimeParameter(TimeParameter.Hours)
if (Housenumber_hours == Housenumber_ON_time) {
if (Housenumber_is_ON == 0) {
Tx_housenumber_control()
}
} else {
Housenumber_is_ON = 0
}
if (input.buttonIsPressed(Button.AB)) {
setting_clock_time = 1
indicating_setting_clock()
}
if (input.buttonIsPressed(Button.A) && !(input.buttonIsPressed(Button.B))) {
if (light_intensity == 2) {
light_intensity = 2
while (input.buttonIsPressed(Button.A)) {
}
} else {
light_intensity = light_intensity - 2
while (input.buttonIsPressed(Button.A)) {
}
}
}
if (input.buttonIsPressed(Button.B) && !(input.buttonIsPressed(Button.A))) {
if (light_intensity == 30) {
light_intensity = 30
while (input.buttonIsPressed(Button.B)) {
}
} else {
light_intensity = light_intensity + 2
while (input.buttonIsPressed(Button.B)) {
}
}
}
}
}
let Housenumber_hours = 0
let light_intensity_hours = 0
let Housenumber_is_ON = 0
let Housenumber_MODE = 0
let Housenumber_ON_time = 0
let setting_clock_time = 0
let light_intensity = 0
let haloDisplay: kitronik_halo_hd.ZIPHaloHd = null
radio.setGroup(200)
kitronik_halo_hd.setBuzzerPin()
kitronik_halo_hd.setTime(22, 59, 0)
haloDisplay = kitronik_halo_hd.createZIPHaloDisplay(60)
light_intensity = 10
setting_clock_time = 0
Housenumber_ON_time = 23
Housenumber_MODE = 0
Housenumber_is_ON = 0
haloDisplay.showRainbow(1, 360)
haloDisplay.show()
for (let index = 0; index < 160; index++) {
basic.pause(25)
haloDisplay.rotate(1)
haloDisplay.show()
}
show_clock_indicators()