Pages: [1]   Go Down
Author Topic: Arduino program help  (Read 984 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
Netherlands
Online Online
Shannon Member
*****
Karma: 168
Posts: 12427
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i think so , check the subsrction gigs & collaborations

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

Rob Tillaart

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

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 !!!
Logged

Global Moderator
Netherlands
Online Online
Shannon Member
*****
Karma: 168
Posts: 12427
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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:
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,


Logged

Rob Tillaart

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

Montreal
Offline Offline
Edison Member
*
Karma: 23
Posts: 2485
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: