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

Automation, sensing and robotics • Re: Switches with serial number (or address)?

$
0
0
I don't think I understand this correctly.
I read you description as each Pico will modify a status message from an upstream Pico before sending it downstream towards the RPi.
That would end in the RPi interpreting all status messages received as coming from the nearest Pico to the RPi.
So first Pico (let's call it 01) detects a change on sensor 4 and sends 0104On. This becomes 0204On, 0304On etc. until it reaches the RPi, which interprets that sensor 4 on Pico xx (the last Pico just before the RPi) has switched on.
That's not going to work - or have I misunderstood something?
If the first Pico detects switch 4 turning on it sends 0004On. The Pi will interpret that as sensor 4 on Pico 0.

If the second Pico detects switch 4 turning on it sends 0004On to the first Pico. The first Pico modifies that to 0104On and sends that to the Pi. The Pi interprets that as sensor 4 on Pico 1.

Third Pico sends 0004On to second Pico which modifies and sends 0104On to first Pico, which modifies and sends 0204On to Pi. Sensor 4 on Pico 2.

Good for up to 100 Picos :-) (0-99).

This way there's no need to set any hardware addresses in the Picos. They all run identical code.
OK, now I get it. I was numbering Pico's the other direction...

Your Pico 00 is connected to the RPi, and your Pico 01 is connected to Pico 00. Increasing numbers the further you get from the RPi.
Pico 01 does know its identity, so it sends 0004On, which gets modified to 0104On when passing through Pico 00. So the RPi now know it's SW4 in Pico 01.

Statistics: Posted by deepo — Mon Nov 18, 2024 6:20 pm



Viewing all articles
Browse latest Browse all 3857

Trending Articles