
So what I would “get” from the RX2 chip is a “set” of lows and HIGHs…meaning RX2 has 5 pins for those “outputs”…Forward/Reverse/Left/Right/Turbo(seldom used)… for example, I get a 1000 for forward, 1(for A0), 0(for A1), 0(for A2), 0(for A3)… for the reverse, will be 0100, 0(for A0), 1(for A1), 0(for A2), 0(for A3)…. ESPHome is a framework that tries to provide the best possible use experience for using ESP8266. there is a certain pin that would output HIGH for forward, another pin for reverse, etc etc… ESPHome Homepage - Reimagining DIY Home Automation. can be forward/backward/forward+left/forward+right/bacward+left/backward+right/turbo+left/turbo+right. Arduino UNO is a microcontroller board based on the ATmega328P. The UNO is the most used and documented board of the whole Arduino family. If this is your first experience tinkering with the platform, the UNO is the most robust board you can start playing with. The RX2 chip is a decoder so no need to decode signals coming from the transmitter. The Arduino UNO is the best board to get started with electronics and coding. Inside void setup() … and NOW it is sounding off… I thought that calling tone(pin,freq) would just do the trick, but it did not… or backward() when a HIGH is read at A1(pin15) or rotate_left() with a HIGH on A2(pin16) or a crabwalk_left() with both a HIGH on A0 & A2… now my 2nd problem was my piezo would not play a tune… but its all fixxed now… I added Guys, MY 1st post was that I was unsure as how I would make a switch case of multiple digitalinput/s (pin14-pin19 OR A0-A5)… in short, this would result to forward() when a HIGH is detected on A0(pin14). Just add some more cases so you have all the combinations of buttons covered. Same with 5 -forward and rotate left mixed together. I use Arduini IDE 1.8.10 with VisualStudio and vMicro Plugin. However, you don’t have a case for say, 17 -which is forward and crab right mixed together. First off, you have assigned different values to each of your inputs so when they are added, you can figure out (with math) what has been hit. If you don't use the break at the end of a case the execution will actually continue to next case definition, and compiler told you that you tried to define int a several times in the same scope. The problem is not because you are using IF’s or Case, it is the fact that you have not told the robot what to do when 2 buttons are being pushed. The switch.case is a very particular syntax. Now, in terms of watching for different buttons that are being hit.
ARDUINO IDE SWITCH CASE CODE
This would make it easier to read and understand your code Binary into constant… The easist way would be to simply use actual numbers instead of binary.Įxpanding on that, you could define these constants with names up at the top of your program:
