Irrecv.resume() // Receive the next valueĬwRotation = !cwRotation //toggle the rotation valueĬcwRotation = false //no rotation in this directionĬcwRotation = !ccwRotation //toggle the rotation valueĬwRotation = false //no rotation in this direction Irrecv.enableIRIn() // Start the receiver #define minus 0xF076C13B //counter clockwise rotation buttonīool cwRotation, ccwRotation //the states of rotation #define plus 0xA3C8EDDB //clockwise rotation button #include //must copy IRremote library to arduino libraries When clicking at any of two buttons the motor is toggling between the rotation and stop Written by: Mohamed Soliman // This code is for controlling servo motor with IR remote control In the final code, the functionality is when clicking at any of two buttons the motor is toggling between the rotation in main direction and stop so when first click at any of two buttons the motor will rotate in button's direction, and when second click at same button the motor will stop as shown in the video. Then detect the HEX code of the buttons using to control the servo motor, assume you will use two buttons of your choice, one for clockwise rotation and another for counter clockwise rotation.įor example, use (+) for clockwise and (-) for counterclockwise, so you have to get their HEX codes. Then open serial monitor and try to click on any button of remote control to send a signal to IR receiver, the HEX code of each button must appear in serial monitor as picture 2 Open IRremote demo example from Arduino IDE as picture 1 then upload to arduino board. First, download IRremote library for arduino from this link.Ĭopy the library to Local Disk(C:) > Program Files(x86) > Arduino > libraries
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |