I have found a few examples but they all output a binary value as a string/text
I'm sending a decimal value from a PC to an Arduino and i want to convert it to binary/bits which will be stored in an array so that i can check the array to see if a digital output should be switched on or not.
Basically sending a decimal value which represents the sum of switches on the PC gui so that i can save the amount of commands transmitted to the arduino (otherwise it means sending 1,1,1,1, etc- 8 switch sum =decimal 256).
I want to have an array where i can check the bit of each switch value converted from decimal.
The array values will not all used to generate a digital pin output, some will be used for program conditions such as run program if PC application shows the power switch is on.
Hi DeltaG Thanks for the reply,
i'm not sure how to use the bit compare methods you have kindly provided, they are still looking like hardware methods. how would I check say bit3 to see if the pc was communicating that a command was being sent.
I was attempting to do something like
If (Input(1) == 1){
PowerOn ==1;
}
using the same method to interrogate all 8 bits.
I have attached my project code and an image of the gui to give you an idea of what i'm working on
you will be pleased to hear I'm a better engineer than a programmer.
This condition will never be true, byte only has 8 bits, "1" is bit 0 turned on, shifting that 8 bits will make it change to 256 which is bigger than byte will ever be.