Home

Docklight Application Note: Arduino Serial Communication

image

Contents

1. 2 Quick Start Blinking LED Example This is a very basic Arduino communication and programming example using Docklight It builds on what is described as the The Hello World of Physical Computing 6 on the Arduino web site e Download and install Docklight V2 0 or higher from http www docklight de download_en htm Download and install the latest Arduino environment from http arduino cc en Main Software 4 e Connect your Arduino board to your PC via USB run arduino exe pate 20130220 C e eee ee Docklight Application Note C a E a a re a 4 a o Applies to Docklight Docklight Scripting V2 0 or higher a PA Flachmann und Page V1 0 initial release 2013 02 20 MF gt Heggelbacher Docklight Application Note 1 7 www fuh edv de E Docklight_Application_Note_ArduinoSerial doc e Open the Arduino Sketch file ArduinoCOM ino E ArduinoCOM Arduino 1 0 File Edit Sketch Tools Help Arduino c cii rduinoC M turn LED L on and off Serial Functionality on Arduino Board Arduina Uno on CORE e Upload the Sketch to your Arduino board e g by using the arrow right toolbar gt e Start Docklight and open the project file Docklight ArduinoSerial ptp e Double click on the Communication Channel s area that shows COM21 by default or use menu Tools gt Project Settings gt Communication to adjust the COM port if necessary amp Docklight V2 0 Project Docklight Ardu
2. a A d Ft Fachmam Docklignt Application Note Arduino Serial Communication Applies to Docklight Docklight Scripting V2 0 or higher Flachmann und Heggelbacher a WWww fuh edv de Page Docklight Application Note Docklight_Application_Note_ArduinoSerial doc else command c add character for receive string 5 Appendix B Docklight Arduino MorseCode pts script code Dockligh ht Arduino MorseCode pts Author MF Dates 2013 02 12 Example script for Docklight Application Note Docklight_Application_Note_ArduinoSerial pdf How to Use Open Docklight project Docklight ArduinoSerial ptp cross check COM port settings as indicated in the project file j and Application Note Start Script Scripting gt Rum Script Shift F3 speed of the Morse code unitDelayMSec 200 Morse code table from A Z SLECCCELIS Tpm riep s ep ae ee Ae OTE a ee pe aa ee 8 aa ne ea aT peep fie pasu Pe mT he _ namS morseArray Split strCodeList DL ClearCommWindows DL StartCommunication Do sendMorseMessage SOS Loop Sub sendMorseMessage ByVal strMessage For i 1 To Len strMessage nextLetter Mid strMessage i 1 If nexcLetter Then the space between words is seven units DL Pause 4 unitDelayMSec we already had 3 units delay after completing the last letter Else sendMorse Mid strMessage i 1 the space between letters is three units DL Pause
3. 2 unitDelayMSec we already had one unit delay within the For Loop End I Next End Sub Sub sendMorse ByVal letter morseCode getMorseCode letter DL AddComment DL AddComment Sending letter amp letter amp amp morsecode For j 1 To Len morsecode DL SendSequence LED ON If Mid morseCode j 1 Then DL Pause 3 unitDelayMSec a dash is three units Else DL Pause unitDelayMSec the length of a dot is one unit End If DL SendSequence LED OFF the space between parts of the same letter is one unit DL Pause unitDelayMSec Oooo ee o Fr Frachann Docklight Application Note CE S A Applies to Docklight Docklight Scripting V2 0 or higher a E N Flachmann und l o 2013 02 20 Heggelbacher Docklight Application Note 6 7 Name sanmo WWW fuh edv de Docklight_Application_Note_ArduinoSerial doc Next End Sub Function getMorseCode ByVal letter arrayIndex Asc UCase letter If arrayIndex gt 65 And arrayIndex lt 90 Then getMorseCode morseArray arrayIndex 65 Else DL AddComment No morse code for amp letter amp DL Quit Enada LI End Function 6 License and Copyright The text of this Application Note is licensed under a Creative Commons Attribution ShareAlike 3 0 License 11 Code samples are released into the public domain Contact E Mail Support docklight fuh edv de Flachmann amp Heggelbacher Waldkirchbogen 27 D 82061 Neuri
4. A 2013702 189 20 22 30 3232 RX 4C 45 44 20 69 73 20 GF OE OD UA Arduino reports LED on 2013 02 18 20t22 56471 TX 6F 26 bO UD UA 2013 02 18 20 22 30 720 RX 4C 45 44 20 69 73 20 6F 66 66 UD DA Arduino reports LED Off 2013 02 189 20722 37052 TIX SF GE Ob 0A 2013 0218 20 221 37 036 RX 4C 45 44 20 69 73 20 OF GE OD UA Arduino reports LED on 2013 02 18 20722337395 TX SBF 66 66 UD OA 2013 02 18 20 22 37 402 RX 4C 45 44 20 69 73 20 6F 66 66 OD OA Arduino reports LED oft And of course the Arduino LED should blink and send out that famous Morse code 10 sequence we all Know from them sinking ships movies O T T pe onon rit Frachmann Docklight Application Note Se a ee Ene i o O j E Applies to Docklight Docklight Scripting V2 0 or higher U ee ee eee a E Flachmann und V1 0 EC 02 20 M S Heggelbacher Docklight Application Note 4 7 Name J remar ursnesowane WWW fuh edv de a Docklight_Application_Note_ArduinoSerial doc 4 Appendix A ArduinoSerialLED ino Program Code ie ArduinoSerialLED ino turn LED L om and off via Serial Functionality on Arduino Board ey j use ourout pin no 13 7 on board LED L const unsigned int LED_PIN 13 use standard baud rate 9600 baud const unsigned long BAUD_RATE 9600 Other baud rates are possible too e g 57600 Just make sure your Docklight project settings are adjusted accordingly 7 Docklight men Tools gt Project
5. Docklight_Application_Note_ArduinoSerial doc Docklight Application Note Arduino Serial Communication Docklight Application Note Arduino Serial COMMUNICATION ccceeececcceceeeeeeeeeeeeeeeeeeeseaaesseeeeeeeessaaaseeeeeeees 1 1 Arduino Board Serial Communication and LED Output cccccceccccccceeseeeeseeeeeeeeeeeseeeeeeeeeeessaaeeeeeeees 1 2 Quick Slant Blinking LED Example ssiessrrneni tdetseciasaseautscehocenctdvoukelxsaweadatbdactecehosencaaenalieeise 1 3 Advanced Example Creating Morse Codes Using Docklight Scripting ccccccssscceeeeesseseeeeeeeeeeeeeeeens 4 4 Appendix A ArduinoSerialLED ino Program COde ccccccssessecccceeeceseeeeeeeeeeeeeeeeeeeeeeeeeesaaeeeeeeeeeeeesssaaageses 5 5 Appendix B Docklight Arduino MorseCode pts script code ccccccceeeseeceeeeeeeeeeeeeeeeeeeeeeeaeeeeeeeeeeesssaaeeees 6 6 License GC OC ossicyseiinsnusagn eina a a DTE aai aaas SE a a E ai aaa a ae i 7 TA a E E an eemalshacSsleaahena inkl amsaaeuahetawhinnsaemesanteees 7 1 Arduino Board Serial Communication and LED Output L TX j Arduino We have tested the Arduino serial Most Arduino boards already have an on board communication described in this Application LED L wired to the output pin no 13 If you run Note using an Arduino UNO It should also this example with no hardware attached to the work on other Arduino boards 3 Arduino you should see this on board LED L blink
6. Note_ArduinoSerial doc e Press Start Communication F5 in Docklight You should see this message in the Docklight Communication Window ASCII 2013 02 18 20 07 09 024 RX Ready lt CR gt lt LF gt Arduino communication established e Using the Docklight Send gt buttons you can now transmit the LED ON and LED OFF ASCII commands to your Arduino board ASCII Commands and confirmation messages from the Arduino are shown in the Docklight Communication Window ASCII 2013 02 18 20 00 44 297 IX On lt CR gt lt LPF gt 2013 02 10 20200744 304 RX LED 19 ONSCR gt lt LF Arduino reports LED on Z0UlLo UZ 1e A000 iios U1 IX OTIC CR lt LES 2013 02 Ll3e 2Us0e 40 041 RX LED 26 off CR lt LFe Arduino reports LED off Of course you will now also see the Arduino board LED L or an external PIN13 LED turned off or on oS OS SiSe SS S S SSE SEE NASOSDAN O RUN TMAN bars Jil PPL tyt l DIGITAL PWM ARDUINO Oooo S ee it Famam Docklight Application Note Oooo e ee E hearted eae aguante gala a es ee eee E Applies to Docklight Docklight Scripting V2 0 or higher ee ee re ee ae oo __ _ __ Fachmann und DE gt Heggelacher Docklight Application Note 2 7 Name f nonmen WWW fuh edv de ee Docklight_Application_Note_ArduinoSerial doc 3 Advanced Example Creating Morse Codes Using Docklight Scripting This is a more advanced command sequence example using Docklight Sc
7. Settings gt Communication Jf anit command buffer String command T boolean command_available false the setup routine runs once when you press reset void setup initialize serial communication according to BAUD_RATE Serial begin BAUD_RATE other settings are SERIAL _8N1 8 data bits no parity one stop Dit while Serial wait for serial port to connect Needed for Leonardo only pinMode LED_PIN OUTPUT configure LED_PIN as output Serial available lt 0 would indicate an error on initialization if Serial available gt 0 Serial println Ready send Ready lt CR gt lt LF gt at start reset after completing setup this gets called consecutively void loop if command_available commands received need to be terminated by lt CR gt lt LF gt characters same as Serial println does it if command on r n digitalWrite LED_PIN HIGH Serial pranctin GED 19 n else if command ori im digitalWrite LED_PIN LOW Serial sprincln LAD is ri else Serial print Unknown command command command clear input buffer command_available false event Handling reading characters void serialkvent while Serial available amp amp command_available const char c Serial read if n 7 Lineteed character is end of command mark command cC command_available true
8. ed Munich Germany http www fuh edv de 7 References 1 Docklight User Manual http www docklight de pdt docklight_manual pdf 2 Docklight Scripting User Manual VBScript Basics http www docklight de manual vbscriptoverview htm 3 Arduino Products http arduino cc en Products 4 Arduino Software Environment http arduino cc en Main Softtware 5 Arduino Language Reference http arduino cc en Reference HomePage 6 Arduino The Hello World of Physical Computing http www arduino cc en T utorial BlinkingLED 7 Arduino Reference Serial http arduino cc en Reference serial 8 Arduino Tutorial SerialEvent http arduino cc en T utorial SerialEvent 9 Arduino Processing Language Comparison http arduino cc en Reference Comparison 10 Wikipedia Morse Code http en wikipedia org wiki Morse code 11 Creative Commons Aittribution ShareAlike 3 0 License http creativecommons org licenses by sa 3 0 a rr es ee pth Flachmann Docklight Application Note eS es ee e ee Applies to Docklight Docklight Scripting V2 0 or higher a TA Flachmann und Page V1 0 initial release 2013 02 20 MF gt Heggelbacher Docklight Application Note 117 www fuh edv de a
9. inoSerial fee x File Edit Run Tools Help Dae Ge r ae FAAA AS a LHe Communication port closed Colors Fonts Mode COM ts 5600 None 3 1 Send Sequences Communication Communication Channells Send Hame Sequence ASCII HE Decimal Binary LED OM an CRs lt LF gt nia LED OFF off lt CH gt LF Project Settings Receive Sequences Communication Flow Control Communicati Active Name Sequence Answer Wed Communication Mode i LED ig on recerved LEO its on lt CR gt i LED is off received LED is off CRs E SendiP 1 2 Wo Atduina reset FReady lt Ch gt lt LF gt e D ra Send Receive on Comm Channel comall NOTE The correct COM port to use is shown in the right lower corner of the Arduino environment COM21 in this example You can also find out using the Windows Device Manager Use the Windows Start menu and type Device Manager in the search box In the Device Manager dialog check the section Ports COM amp LPT for the Arduino entry TIP If the COM port used for your Arduino Hardware is not shown in Docklight Project Settings drop down list just type in the correct COM port in the text box e g COM21 pte 20130220 C S ee ee Docklight Application Note Se E S Applies to Docklight Docklight Scripting V2 0 or higher c Flachmann und rage initial release 2013 02 20 Heggelbacher Docklight Application Note 217 Ramo Mow ied Docklight_Application_
10. ripting an extended edition of Docklight that features a VBScript based programming environment NOTE VBScript Docklight Scripting provide easy serial communication access and similar programming capabilities to the Arduino C C language set but the language syntax is different in detail See also http www docklight de manual vbscriptoverview htm 2 and http arduino cc en Reference Comparison 9 How to run the Docklight Scripting example e Make sure the Arduino environment is set up and ready as explained in the previous section 2 Quick Start Blinking LED Example e Download and install Docklight Scripting V2 0 or higher from http www docklight de download_en htm e Start Docklight Scripting and open the project file Docklight ArduinoSerial ptp Then open the script Docklight Arduino MorseCode pts using menu Scripting gt Open Script e Run the script using menu Scripting gt Run Script Shift F5 You should see these messages in Docklight Communication Window Hex 2013 02 13 20 22 34 924 RX 52 65 61 64 79 OD 0A Arduino Communication established Sending character S 2013 02 183 20tz2t35 720 TIX SF SE D A 2013 02 19 20 22 39 7227 RX 40 45 44 20 69 73 20 GF OE OD UA Arduino reports LED on 2013 02 18 20 22 30 041 TX BF 66 G66 UD UA 2013 02 18 20 22 30 050 RX 4C 45 44 20 69 723 20 OF 66 66 UD DA Arduino reports LED off 2013 02 1389 2Z0tZ2t36 s75 IX F GE 0D U

Download Pdf Manuals

image

Related Search

Related Contents

Owner`s Manual II:RRFTSMRN`  Acco Quartet Reversible Total Erase Mobile Easel  MAP Check 3 PC Software  Kabelloser Geräte-Manager Modell: ESM600 / ESM600U  Bedienungshandbuch - PresTek Hidrolik Press Sanayi  Videocamera HD digitale  Ados : mode d`emploi - Commission scolaire du Fer  Geovision GV-FE4301  HDV-Z180/Z180S Video Light User Guide Guide de l  2308-900-01 (A - Jul 2008)(User)  

Copyright © All rights reserved.
Failed to retrieve file