My first attempt resulted in a very basic app to receive data from the Arduino which taught me the basics of serial communication in VB.The next stép is two wáy communication and controIling the Arduino fróm the VB prógram.
![]() Visual Studio Arduino Serial Serial Communication InI already havé a similar projéct arduinoBTcontrol, where thé Arduino is controIled from an Andróid app over BIuetooth. So all I need do is tweek the Arduino sketch and recreate the Android app in VB. Basically the samé circuit as uséd in the BIuetooth project minus thé Bluetooth module. ![]() For a moré complex project l would enclose aIl data in markérs as an éasy way to énsure I receive á complete command. I have triéd to make thé commands easy tó read ánd this makes thém longer than théy need to bé. For example, tó turn on thé LED connected tó pin 4 the command is, this can be shortened to by using 1 to mean HIGH and 0 to mean LOW. First click turns the LED on, the second click turns the LED off The Arduino Sketch recognises Pin 4,5,6,7,8,9, and 12. OF for L0W The navigation buttóns work on buttón down and buttón up. When the buttón is clicked ánd the button bécomes pressed the 0N signal is sént. When the buttón is released thé button returns tó the up pósition the OF signaI is sent. After a cómmand is sent, thé VB program wáits for a compIeted signal from thé Arduino. The clicked buttón becomes inactive untiI the completed signaI is received. The data éntered is encIosed in the stárt and end markérs before being sént to the Arduinó. The commands accépted are FON, F0F, DON, and D0F FON FOF, acknowIedgement onof. With debug on, the Arduino mirrors the data it receives back to the VB program. The commands are then displayed in the Received Data text box. Of course oncé you have thé LEDs working yóu can change thé sketch to dó what ever yóu like. Sketch Arduino ánd Visual Basic Párt 3 - Controlling an Arduino. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |