Hello, im a beginner in programming arduino. Ive got a project that combining 3 command into 1 action but im confused on how to do it. The command is Bluetooth, fingerprint and keypad. The action is to on and off the solenoid lock. What i mean is theres 3 command combine and i can pick which one i want to use to give action to solenoid lock. How to combine the code?
How to combine the code?
apply the principles shown here:-
http://www.thebox.myzen.co.uk/Tutorial/Merging_Code.html
However I suspect that you don't want to do that at all, you want to write one code that does the functions you want.
Thanks for the reply
And yes i wanna write some code but i didnt do that now because im afraid to make it complicated. I already done both a single command for bluetooth and keypad and im in progress for fingerprint. But my main problem is to combine that 3 command into 1 void setup and 1 void loop.
“I already done both a single command for bluetooth and keypad and im in progress for fingerprint.”
If you have written code for bluetooth, a fingerprint reader and a keypad it’s odd you are asking this question.
If you just copy other people’s code and you want to add two more sketches that other people have written then you should learn to write your own code.
“im afraid to make it complicated.”
Don’t be afraid, learning to be a methodical and successful programmer takes time and requires ‘you’ to put the time in to learn the basics. Don’t take shortcuts, learn how to do things one step at a time.
Thanks
Actually my intention is simple. For the example i want to use 3 main command 1.Bluetooth, 2.Fingerprint, 3.matrix keypad to on and off the LED. I can choose either to use which command to on and off the LED. I noticed that its kind of error to randomly put 3 command into 1 sketch and upload it into arduino but i believe it is not possible to do it so there must be some kind of trick. Ofcourse im willing to learn and take my time for it because programming is fun to me but its an urgent matter to accomplish it before 1st November. And im sincerely need help for make it happen. Thank you
Do you understand what you read from Grumpy_Mike's discussion?
If not, what part do you not understand?
http://www.thebox.myzen.co.uk/Tutorial/Merging_Code.html
Show us the three sketches you wrote to be combined.
Use CTRL T to format the sketches.
Please use code tags.
Use the </> icon in the posting menu.
[code]Paste sketch here. [/code]
Hi Nazriffe,
... For the example i want to use 3 main command 1.Bluetooth, 2.Fingerprint, 3.matrix keypad to on and off the LED.
...
We get that. Actually bluetooth, fingerprint and a keypad are not commands, they are technologies. With an Arduino, you will use many commands in C/C++ to interact with each of those technologies to accomplish the actions you want.
This application is perfect for Arduino technology, as it needs to be approached on a low level. Fortunately, programming Arduino at a low level is easy, and it's the natural way to program Arduino using the IDE in the Arduino environment.
First step is to consider the logic of your overall scheme. Do all three factors (paired to the device with Bluetooth, supply an authorized fingerprint, and type in the correct passcode) need to be satisfied, or do you want to satisfy any single one of them?
Your next task is choose your devices and discover how to use them to get a 'yes' or 'no' result from each one. This is where looking at other people's code is most useful. If you buy some devices (say a bluetooth module, fingerprint module, and a keypad), they may comes with an example sketch so you can see how to interact with the device. Borrowing code from included examples is a good first step to making your own program.
Third, learn basic C programming. There are many ways to do this, but I recommend the book I learned Arduino programming (and C) from: Beginning C for Arduino by Jack Purdum. You will need programming knowledge because you will end up writing most of final program, albeit a little bit at a time.
Your finished program may use change based polling to cycle through reading each device, and subroutines that interface with the devices. All of these subroutines return true
or false
values that can all be handled the same way regardless of which device was being read.
Finally decide on your output device, such as the electromagnetic switch. It will probably involve some power management to be sure there is enough to operate the device reliably.
Good luck. This forum really is a 'genius bar'. Although there is a lot of blunt talk here, you can get the best personal tutoring available no matter which direction your project goes.