Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4104

General • Re: WiFi configuration without a display

$
0
0
Pulsing the LED? Do you expect somebody to count 192 and then 168 pulses?
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 pulses :lol:

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-------.                           |# |                    _             _     _                                |# |  ___|||||_____|___| |___|___|___| |___| |___|_|___                      |# |                                                                         |# `-------------------------------------------------------------------------'
Thus the output will be as below. It helps to have two people; one monitoring the pulses, calling out "start", "blip", "one", "two" ... "double-blip", while the other writes those down.

Code:

# .-------------------------------------------------------------------------.# |                                                                         |# |  _|||||_                                            Start               |# |                                                                         |# |  _|__-__|__-_-_-_-_-_-_-_-_-__|__-_-__||_           1 9 2               |# |                                                                         |# |  _|__-__|__-_-_-_-_-_-__|__-_-_-_-_-_-_-_-__||_     1 6 8               |# |                                                                         |# |  _|___||_                                           0                   |# |                                                                         |# |  _|__-_-__|___|__-_-_-_-_-_-_-_-__||_               2 0 8               |# |                                                                         |# `-------------------------------------------------------------------------'
Zeroes, particularly a zero octet, feel a bit odd but, as long as they are explained, it should be easy enough to use. A very long pulse is an alternative but I didn't feel that was any better. If you just output the last octet that shouldn't be problematic

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)
That can be optimised and shortened -

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)
An alternative to using a LED would be a piezo sounder which would be easier to follow and record without enlisting help from someone else. That will save on having to make two cups of tea and using up another tea bag.

Statistics: Posted by hippy — Sun Feb 04, 2024 6:17 pm



Viewing all articles
Browse latest Browse all 4104

Trending Articles