Go Down

Topic: Arduino program help (Read 1 time) previous topic - next topic

fawadskj

Hello ..
I need some help to create a program that will do a function like , reading different value for the sensor,
e.g an arduino can receive different digital input , the controller should combine all this , and then convert it to HEX , and then sent this code to an another mobile no..
Can anyone can help me in making this program.

robtillaart

i think so , check the subsrction gigs & collaborations

and please be more specific because it is still vague what you want ....
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

fawadskj

As i am doing a project , so i want that the different switches status , mean On or Off , 0 or 1 , this is the digital input to the Arduino , then the Arduino combine the 10 different status of the switches,
like this 1000110000 ,,,, so this code is then converted to HEX format , and the HEX format should be sent by an GSM Modem or Mobile Phone..
So how can i do this !!!

robtillaart


Just collect the bits and put them in the right place using bitWrite - http://www.arduino.cc/en/Reference/BitWrite -

one integer can hold 16 bit so it can easy hold your 10 bits
Code: [Select]

int ALL = 0;
for(uint8_t i=0; i<10; i++)
{
  bitWrite(ALL, i, digitalRead(i));
}
Serial.println(ALL, HEX);

Please not this is only a code snippet, it is not a complete sketch. Therefor you will have to make a sketch out of it. But all the 'difficult ' parts you need are in there.

Please spend a few days on the tutorial section and the reference section as there is a lot to learn there. You will see many language constructs and how to do things like you asked. Time spend there is not time lost.

Succes,


Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Magician

And this topic explain how to send SMS:
http://arduino.cc/forum/index.php/topic,50691.0/topicseen.html

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy