I was thinking pad each of my "192.168.0.199" octets into three digit numbers, then string them together - 192,168,000,199 - and then just count the pulsesPulsing the LED? Do you expect somebody to count 192 and then 168 pulses?
What I actually do is pulse per digit. But zeroes are a bugger so I have short pulses for framing, a burst to indicate start of IP Address then a blip for separate digits, a double-blip to terminate each octet -
Code:
# .-------------------------------------------------------------------------.# | |# | Start .----1----.-0-.-------2-------. |# | _ _ _ |# | ___|||||_____|___| |___|___|___| |___| |___|_|___ |# | |# `-------------------------------------------------------------------------'
Code:
# .-------------------------------------------------------------------------.# | |# | _|||||_ Start |# | |# | _|__-__|__-_-_-_-_-_-_-_-_-__|__-_-__||_ 1 9 2 |# | |# | _|__-__|__-_-_-_-_-_-__|__-_-_-_-_-_-_-_-__||_ 1 6 8 |# | |# | _|___||_ 0 |# | |# | _|__-_-__|___|__-_-_-_-_-_-_-_-__||_ 2 0 8 |# | |# `-------------------------------------------------------------------------'
This is the code. All the 'print' can be removed; those were just for proving that it works.
Code:
led = Pin("LED", Pin.OUT)while True: print("_|||||_") for n in range(5): led.on() time.sleep(0.125) led.off() time.sleep(0.125) time.sleep(5) print("_", end="") for c in ip + ".": if c == ".": print("||_") led.on() time.sleep(0.125) led.off() time.sleep(0.125) led.on() time.sleep(0.125) led.off() time.sleep(2) print("_", end="") else: print("|__", end="") led.on() time.sleep(0.125) led.off() time.sleep(2) for n in range(int(c)): print("-_", end="") led.on() time.sleep(1) led.off() time.sleep(1) print("_", end="") time.sleep(1) print("") time.sleep(8)
Code:
led = Pin("LED", Pin.OUT)def Pulse(onTime, offTime): led.on() time.sleep(onTime) led.off() time.sleep(offTime)while True: for n in range(5): Pulse(0.125, 0.125) time.sleep(5) for c in ip + ".": if c == ".": Pulse(0.125, 0.125) Pulse(0.125, 2) else: Pulse(0.125, 2) for n in range(int(c)): Pulse(1, 1) time.sleep(1) time.sleep(8)
Statistics: Posted by hippy — Sun Feb 04, 2024 6:17 pm