g      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ [ \ ] ^ _ ` a b cdef experimentalerkokl@gmail.comNone g3Delay (wait) for the given number of milli-seconds hWA simple printer that can keep track of sequence numbers. Used for debugging purposes. i!Show a byte in a visible format. jShow a list of bytes k Show a number as a binary value l Turn a lo/9hi encoded Arduino string constant into a Haskell string m Turn a lo/?hi encoded Arduino sequence into a bunch of words, again weird  encoding. nTurn a normal byte into a lo/,hi Arduino byte. If you think this encoding  is just plain weird, you'0re not alone. (I suspect it has something to do D with error-correcting low-level serial communication of the past.) oConvert a word to it'/s bytes, as would be required by Arduino comms p"Inverse conversion for word2Bytes ghijklmnop ghijklmnop ghijklmnop experimentalerkokl@gmail.com Safe-InferredXConvert a character to a bit-pattern, suitable for display on a seven-segment display. W Note that most characters are just not representable in a 7-segment display, in which  case we map it to q5. However, some substitutions are done, for instance '(' is  displayed the same as '['. The return value is a r@, although only 7-bits are used; the least significant bit will [ always be 0. With the traditional coding, the bits correspond to segments ABCDEFG0, i.e., L most-significant-bit will be for segment A, next for segment B, and so on.  experimentalerkokl@gmail.comNoneysSys-ex commands, see: http: firmata.orgwikiProtocol#Sysex_Message_Format t0x7F& MIDI Reserved for realtime messages u0x7E* MIDI Reserved for non-realtime messages v0x7A sampling interval w0x79* report name and version of the firmware x0x78D Configure special I2C settings such as power pins and delay times y0x77 I2C reply messages from an I/O board to a host z0x76* I2C request messages from a host to an I/O board {0x75 shiftOut config/data message (34 bits) |0x74 Pulse, see: https: github.comrwldrn johnny-fiveissues18 }0x71) a string message with 14-bits per char ~0x70* set max angle, minPulse, maxPulse, freq 0x6F, analog write (PWM, Servo, etc) to any pin 0x6E reply with a pin's current mode and value 0x6D ask for a pin's current mode and value 0x6C, reply with supported modes and resolution 0x6B5 ask for supported modes and resolution of all pins 0x6A reply with mapping info 0x69+ ask for mapping of analog to pin numbers 0x00F 2nd SysEx data byte is a chip-specific command (AVR, PIC, TI, etc). Firmata commands, see: http: firmata.orgwikiProtocol#Message_Types 0xFF 0xF9 0xF7 0xF4 0xF00xD0 port 0xC0 pin 0x90 port 0xE0 pin The Arduino monad. State of the computation Current debugging routine 7Clean-up and quit with a hopefully informative message $Serial port we are communicating on 8The ID of the board (as identified by the Board itself) Current state of the board !Incoming messages from the board Capabilities of the board ThreadId of the listener State of the board Capabilities of the board  Which analog pins are reporting !Which digital pins are reporting For-each pin, store its data ;Semaphore list to wake-up upon receiving a digital message LCD's attached to the board 4State of the LCD, a mere 8-bit word for the Hitachi Display mode (leftrightscrolling etc.) Display control (blink onoff, display on off etc.) 5Count of custom created glyphs (typically at most 8) Actual controller Hitachi LCD controller: See:  ;http://en.wikipedia.org/wiki/Hitachi_HD44780_LCD_controller. ^ We model only the 4-bit variant, with RS and EN lines only. (The most common Arduino usage.)  The data sheet can be seen at:  4http://lcd-linux.sourceforge.net/pdfdocs/hd44780.pdf.  Hitachi pin  4: Register-select  Hitachi pin  6 : Enable  Hitachi pin 11 : Data line 4  Hitachi pin 12 : Data line 5  Hitachi pin 13 : Data line 6  Hitachi pin 14 : Data line 7 *Number of rows (typically 1 or 2, upto 4) -Number of cols (typically 16 or 20, upto 40) "Set to True if 5x10 dots are used LCD's connected to the board Data associated with a pin 2What the board is capable of and current settings Capabilities of a pin Analog pin number, if any Allowed modes and resolutions #Resolution, as referred to in http: firmata.orgwikiProtocol#Capability_Query I TODO: Not quite sure how this is used, so merely keep it as a Word8 now )A response, as returned from the Arduino *Represents messages currently unsupported Repsonse to a PulseInCommand Status of an analog pin Status of a port Analog pin mappings Capabilities report Firmware version (maj/min and indentifier A request, as sent to Arduino ?Request for a pulse reading on a pin, value, duration, timeout Set the sampling interval -Send an analog-write; used for servo control #Set the values on a port digitally "Analog report values on pin enable/disable $Digital report values on port enable/disable Set the mode on a pin !Query the mapping of analog pins $Query the capabilities of the board $Query the Firmata version installed Send system reset The mode for a pin. *I2C (Inter-Integrated-Circuit) connection Shift controller Servo Motor controller %PWM (Pulse-Width-Modulation) output  Analog input Digital output Digital input GA pin on the Arduino, as viewed by the library; i.e., real-pin numbers 3A pin on the Arduino, as specified by the user via , , and  functions. A port (containing 8 pins) The port number <Declare a pin by its index. For maximum portability, prefer   and < functions, which will adjust pin indexes properly based on F which board the program is running on at run-time, as Arduino boards H differ in their pin numbers. This function is provided for cases where J a pin is used in mixed-mode, i.e., both for digital and analog purposes, G as Arduino does not really distinguish pin usage. In these cases, the M user has the proof obligation to make sure that the index used is supported - on the board with appropriate capabilities. QDeclare an digital pin on the board. For instance, to refer to digital pin no 12  use  12. NDeclare an analog pin on the board. For instance, to refer to analog pin no 0  simply use  0.  Note that  02 on an Arduino UNO will be appropriately adjusted K internally to refer to pin 14, since UNO has 13 digital pins, while on an Q Arduino MEGA, it will refer to internal pin 55, since MEGA has 54 digital pins; A and similarly for other boards depending on their capabilities.  (Also see the note on  for pin mappings.) 2On the Arduino, pins are grouped into banks of 8. @ Given a pin, this function determines which port it belongs to 2On the Arduino, pins are grouped into banks of 8. M Given a pin, this function determines which index it belongs to in its port 2Debugging only: print the given string on stdout. 6Bailing out: print the given string on stdout and die #Which modes does this pin support? Current state of the pin <Given a pin, collect the digital value corresponding to the E port it belongs to, where the new value of the current pin is given  The result is two bytes: " First lsb: pins 0-6 on the port ' * Second msb: pins 7-13 on the port HIn particular, the result is suitable to be sent with a digital message -Keep track of listeners on a digital message 'Compute the numeric value of a command $Convert a byte to a Firmata command  Convert a s to a byte Convert a byte into a s Keep track of pin-mode changes iA mode was removed from this pin, update internal state and determine any necessary actions to remove it 5Depending on a mode-set call, determine what further - actions should be executed, such as enabling disabling pinport reporting =On the arduino, digital pin numbers are in 1-to-1 match with G the board pins. However, ANALOG pins come at an offset, determined by B the capabilities query. Users of the library refer to these pins D simply by their natural numbers, which makes for portable programs F between boards that have different number of digital pins. We adjust  for this shift here. WSimilar to getInternalPin above, except also makes sure the pin is in a required mode. stuvwxyz{|}~ stuvwxyz{|}~ +s~}|{zyxwvut      experimentalerkokl@gmail.comNone.Wrap a sys-ex message to be sent to the board Construct a non sys-ex message APackage a request as a sequence of bytes to be sent to the board  using the Firmata protocol. Unpackage a SysEx response Unpackage a Non-SysEx response  experimentalerkokl@gmail.comNone.Run the Haskell program to control the board: @ The file path argument should point to the device file that is " associated with the board. (COM1 on Windows,  '/dev/cu.usbmodemfd131' on Mac, etc.) ; The boolean argument controls verbosity. It should remain  5 unless you have communication issues. The print-out D is typically less-than-useful, but it might point to the root  cause of the problem. See &System.Hardware.Arduino.Examples.Blink for a simple example. Send down a request. 4Receive a sys-ex response. This is a blocking call. VReceive a sys-ex response with time-out. This is a blocking call, and will wait until 8 either the time-out expires or the message is received VStart a thread to listen to the board and populate the channel with incoming queries. LInitialize our board, get capabilities, etc. Returns True if initialization  went OK, False if not. If !, debugging info will be printed Path to the USB port &The Haskell controller program to run  experimentalerkokl@gmail.comNoneHRetrieve the Firmata firmware version running on the Arduino. The first I component is the major, second is the minor. The final value is a human / readable identifier for the particular board. 9Delay the computaton for a given number of milli-seconds :Time a given action, result is measured in micro-seconds. >Time-out a given action. Time-out amount is in micro-seconds. .Set the mode on a particular pin on the board (Set or clear a digital pin on the board Turn on/.off internal pull-up resistor on an input pin !PRead the value of a pin in digital mode; this is a non-blocking call, returning $ the current value immediately. See "' for a version that waits for a change  in the pin first. "PWait for a change in the value of the digital input pin. Returns the new value. D Note that this is a blocking call. For a non-blocking version, see !, which returns the current  value of a pin immediately. #^Wait for a change in any of the given pins. Once a change is detected, all the new values are  returned. Similar to ">, but is useful when we are watching multiple digital inputs. $\Wait for any of the given pins to go from low to high. If all of the pins are high to start d with, then we first wait for one of them to go low, and then wait for one of them to go back high.  Returns the new values. %[Wait for any of the given pins to go from high to low. If all of the pins are low to start d with, then we first wait for one of them to go high, and then wait for one of them to go back low.  Returns the new values. :A utility function, waits for any change on any given pin ( and returns both old and new values. It's guaranteed that 3 at least one returned pair have differing values. &sSend down a pulse, and measure how long the pin reports a corresponding pulse, with a potential time-out. The call pulse p v duration mbTimeOut  does the following:  Set the pin to value v for duration microseconds.  Waits 2 microseconds  Waits until pin p has value not v. 8 Returns, in micro-seconds, the duration the pin stayed v(, counting from the 2 microsecond wait. 'Time-out parameter is used as follows:  If  mbTimeOut is Nothing, then &P will wait until the pin attains the value required and so long as it holds it. E Note that very-long time-out values are unlikely to be accurate.  If  mbTimeOut is Just t then, &T will stop if the above procedure does not complete within the given micro-seconds. . In this case, the overall return value is Nothing. MNB. Both the time-out value and the return value are given in micro-seconds. ,NB. As of March 2 2013; StandardFirmata that'(s distributed with the Arduino-App does not support the Pulse-In command. 5 However, there is a patch to add this command; see:  .http://github.com/rwldrn/johnny-five/issues/18 for details.  If you want to use hArduino's pulseIn command, then you have3 to install the above patch. Also see the function  pulseIn_hostOnly[, which works with the distributed StandardFirmata: It implements a version that is not as T accurate in its timing, but might be sufficient if high precision is not required. 'A hostOnlyS version of pulse-out on a digital-pin. Use this function only for cases where the _ precision required only matters for the host, not for the board. That is, due to the inherent ; delays involved in Firmata communication, the timing will not be accurate, and should not Q be expected to work uniformly over different boards. Similar comments apply for (  as well. See the function & for a more accurate version. (A hostOnlyR version of pulse-in on a digital-pin. Use this function only for cases where the _ precision required only matters for the host, not for the board. That is, due to the inherent ; delays involved in Firmata communication, the timing will not be accurate, and should not Q be expected to work uniformly over different boards. Similar comments apply for '  as well. See the function & for a more accurate version. )QRead the value of a pin in analog mode; this is a non-blocking call, immediately . returning the last sampled value. It returns 0 if the voltage on the pin  is 0V, and 1023$ if it is 5V, properly scaled. (See * for  sampling frequency.) *kSet the analog sampling interval, in milliseconds. Arduino uses a default of 19ms to sample analog and I2C [ signals, which is fine for many applications, but can be modified if needed. The argument  should be a number between 10 and 16384; 10: being the minumum sampling interval supported by Arduino  and 16383^ being the largest value we can represent in 14 bits that this message can handle. (Note that ! the largest value is just about 16? seconds, which is plenty infrequent for all practical needs.)  !"#$%&'Pin to send the pulse on  Pulse value bTime, in microseconds, to signal beginning of pulse; will send the opposite value for this amount )Pulse duration, measured in microseconds ()* !"#$%&'()* !"#$%&'()* experimentalerkokl@gmail.comNone++1An abstract symbol type for user created symbols +Various control masks for the Hitachi44780 bit 1 Controls left/right entry mode bit 0 Controls left/ right scroll bit 2 Controls whether display is on bit 1 Controls whether cursor is on bit 0 Controls whether cursor blinks Commands understood by Hitachi !Convert a command to a data-word +Initialize the LCD. Follows the data sheet  4http://lcd-linux.sourceforge.net/pdfdocs/hd44780.pdf,  page 46; figure 24. +Get the controller associated with the LCD %Send a command to the LCD controller &Send 4-bit data to the LCD controller ?By controlling the enable-pin, indicate to the controller that & the data is ready for it to process. Transmit data down to the LCD JHelper function to simplify library programming, not exposed to the user. ,`Register an LCD controller. When registration is complete, the LCD will be initialized so that:  Set display ON (Use 8 / 7 to change.)  Set cursor OFF (Use 6 / 5 to change.)  Set blink OFF (Use 4 / 3 to change.)  Clear display (Use . to clear, - to display text.) # Set entry mode left to write (Use 9 / : to control.)  Set autoscrolling OFF (Use < / ; to control.) ( Put the cursor into home position (Use 0 or / to move around.) -9Write a string on the LCD at the current cursor position .Clear the LCD /!Send the cursor to home position 0QSet the cursor location. The pair of arguments is the new column and row numbers  respectively: W The first value is the column, the second is the row. (This is counter-intuitive, but b is in line with what the standard Arduino programmers do, so we follow the same convention.) 3 Counting starts at 0 (both for column and row no) \ If the new location is out-of-bounds of your LCD, we will put it the cursor to the closest # possible location on the LCD. 1uScroll the display to the left by 1 character. Project idea: Using a tilt sensor, scroll the contents of the display  left/right depending on the tilt. 2/Scroll the display to the right by 1 character 3Display characteristics helper, set the new control/mode and send * appropriate commands if anything changed   Update the display control word  Update the display mode word  %Convert the mask value to the bit no  Clear by the mask  Set by the mask 3Do not blink the cursor 4Blink the cursor 5NHide the cursor. Note that a blinking cursor cannot be hidden, you must first  turn off blinking. 6Show the cursor 7NTurn the display off. Note that turning the display off does not mean you are O powering it down. It simply means that the characters will not be shown until  you turn it back on using 8. (Also, the contents will not be L forgotten when you call this function.) Therefore, this function is useful . for temporarily hiding the display contents. 8Turn the display on 9%Set writing direction: Left to Right :%Set writing direction: Right to Left ;WTurn on auto-scrolling. In the context of the Hitachi44780 controller, this means that W each time a letter is added, all the text is moved one space to the left. This can be  confusing at first: It does not2 mean that your strings will continuously scroll: P It just means that if you write a string whose length exceeds the column-count  of your LCD, then you'Dll see the tail-end of it. (Of course, this will create a scrolling @ effect as the string is being printed character by character.) ]Having said that, it is easy to program a scrolling string program: Simply write your string  by calling -, and then use the 1 and 2 functions 4 with appropriate delays to simulate the scrolling. <.Turn off auto-scrolling. See the comments for ; for details. When turned & off (which is the default), you will not4 see the characters at the end of your strings that  do not fit into the display. =!Flash contents of the LCD screen >@Create a custom symbol for later display. Note that controllers E have limited capability for such symbols, typically storing no more H than 8. The behavior is undefined if you create more symbols than your  LCD can handle. IThe input is a simple description of the glyph, as a list of precisely 8 G strings, each of which must have 5 characters. Any space character is L interpreted as a empty pixel, any non-space is a full pixel, corresponding K to the pixel in the 5x8 characters we have on the LCD. For instance, here's ! a happy-face glyph you can use:   [ " "  , "@ @"  , " "  , " "  , "@ @"  , " @@@ "  , " "  , " "  ]  ?/Display a user created symbol on the LCD. (See > for details.) @\Access an internally stored symbol, one that is not available via its ASCII equivalent. See , the Hitachi datasheet for possible values:  4http://lcd-linux.sourceforge.net/pdfdocs/hd44780.pdf, Table 4 on page 17. 0For instance, to access the symbol right-arrow: b Locate it in the above table: Right-arrow is at the second-to-last row, 7th character from left.  Check the upper/Ghigher bits as specified in the table: For Right-arrow, upper bits are 0111 and the  lower bits are 1110; which gives us the code 01111110, or 0x7E. 0 So, right-arrow can be accessed by symbol code @ 0x7E, which will give us a + value  that can be passed to the ?* function. The code would look like this: +lcdWriteSymbol lcd (lcdInternalSymbol 0x7E). 6+,-./012     3456789:;<= Flash count  Delay amount (in milli-seconds) >?@! +,-./0123456789:;<=>?@! ,.-/0;<129:436587+@?>=&+ ,-./012     3456789:;<=>?@ experimentalerkokl@gmail.comNone  !"#$%&'()* ! "#$%('&*) experimentalerkokl@gmail.comNoneA@The Texas-Instruments 74HC595 8-bit shift register with 3-state  outputs. Data sheet:  .http://www.ti.com/lit/ds/symlink/sn74hc595.pdf. KThis is a versatile 8-bit shift-register with separate serial and register M clocks, allowing shifting to be done while the output remains untouched. We K model all control pins provided. Note that the enable and clear lines are  negated. CChip Pin: 14: Serial input D$Chip Pin: 13: Negated output-enable E1Chip Pin: 12: Register clock, positive triggered F/Chip Pin: 11: Serial clock, positive triggered G!Chip Pin: 10: Negated clear-data HYChip Pins: 15, 1-7, and 8: Sequence of output bits, connect only if reading is necessary I=A shift-register class as supported by the hArduino library. J Capacity K Display name LData sheet (typically a URL) MInitialize the shift-register N9Disable the output, putting it into high-impedance state O>Enable the output, getting it out of the high-impedance state PClear the contents Q*Push a single bit down the shift-register R3Store the pushed-in values in the storage register SRead the current value stored HExecute action, followed by a simulated falling edge on the given clock ABCDEFGHIJKLMNOPQRSABCDEFGHIJKLMNOPQRSIJKLMNOPQRSABCDEFGHABCDEFGHI JKLMNOPQRS experimentalerkokl@gmail.comNoneT4A servo motor. Note that this type is abstract, use U to  create an instance. )The internal-pin that controls the servo =Pulse-width (microseconds) for the minumum (0-degree) angle. IPulse-width (microseconds) for the maximum (typically 180-degree) angle. U=Create a servo motor instance. The default values for the min/'max angle pulse-widths, while typical, e may need to be adjusted based on the specs of the actual servo motor. Check the data-sheet for your 8 servo to find the proper values. The default values of 544 and 2400( microseconds are typical, so you might  want to start by passing q1 for both parameters and adjusting as necessary. VOSet the angle of the servo. The argument should be a number between 0 and 180, 2 indicating the desired angle setting in degrees. TUEPin controlling the servo. Should be a pin that supports SERVO mode. GPulse-width (in microseconds) for the minumum 0-degree angle. Default: 544. UPulse-width (in microseconds) for the maximum, typically 180-degree, angle. Default: 2400. VTUVTUVTUV experimentalerkokl@gmail.comNone8 +,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUV experimentalerkokl@gmail.comNoneW@Read the value of an analog input line. We will print the value A on the screen, and also blink a led on the Arduino based on the 5 value. The smaller the value, the faster the blink. DThe circuit simply has a 10K potentiometer between 5V and GND, with H the wiper line connected to analog input 3. We also have a led between  pin 13 and GND.  nhttp://github.com/LeventErkok/hArduino/raw/master/System/Hardware/Arduino/SamplePrograms/Schematics/Analog.png WWWW experimentalerkokl@gmail.comNoneX=Blink the led connected to port 13 on the Arduino UNO board. NNote that you do not need any other components to run this example: Just hook Q up your Arduino to the computer and make sure StandardFirmata is running on it. N However, you can connect a LED between Pin13 and GND if you want to blink an * external led as well, as depicted below:  mhttp://github.com/LeventErkok/hArduino/raw/master/System/Hardware/Arduino/SamplePrograms/Schematics/Blink.png XXXX experimentalerkokl@gmail.comNoneY5Read the value of a push-button (NO - normally open) ? connected to input pin 2 on the Arduino. We will continuously 4 monitor and print the value as it changes. Also, we'll turn 2 the led on pin 13 on when the switch is pressed. @The wiring is straightforward: Simply put a push-button between 5 digital input 2 and +5V, guarded by a 10K resistor:  nhttp://github.com/LeventErkok/hArduino/raw/master/System/Hardware/Arduino/SamplePrograms/Schematics/Button.png YYYY  experimentalerkokl@gmail.comNoneZITwo push-button switches, controlling a counter value. We will increment  the counter if the first one (bUp-) is pressed, and decrement the value if the  second one (bDownA) is pressed. We also have a led connected to pin 13 (either use S the internal or connect an external one), that we light up when the counter value  is 0. KWiring is very simple: Up-button connected to pin 4, Down-button connected  to pin 2, and a led on pin 13.  ohttp://github.com/LeventErkok/hArduino/raw/master/System/Hardware/Arduino/SamplePrograms/Schematics/Counter.png ZZZZ  experimentalerkokl@gmail.comNone[(Sound travels 343.2 meters per seconds ( +http://en.wikipedia.org/wiki/Speed_of_sound). \ The echo time is round-trip, from the sensor to the object and back. Thus, if echo is high  for d4 microseconds, then the distance in centimeters is:  ! d * 10^-6 * 343.2 * 10^2 / 2  = 1.716e-2 * d \QMeasure and display the distance continuously, as reported by an HC-SR04 sensor. GWiring: Simply connect VCC and GND of HC-SR04 to Arduino as usual. The Echo! line on the sensor is connected  to Arduino pin 2. The Trig' line is connected on the board to the Echo& line, i.e., they both connect to the M same pin on the Arduino. We also have a led on pin 13 that we will light-up U if the distance detected is less than 2 centimeters, indicating an impending crash!  phttp://github.com/LeventErkok/hArduino/raw/master/System/Hardware/Arduino/SamplePrograms/Schematics/Distance.png [\[\[\[\  experimentalerkokl@gmail.comNone],Connections for a basic hitachi controller.  See  ;http://en.wikipedia.org/wiki/Hitachi_HD44780_LCD_controller for G pin layout. For this demo, simply connect the LCD pins to the Arduino  as follows:   LCD pin 01 to GND  LCD pin 02 to +5V  LCD pin 03 to a 10K potentiometer's viper  LCD pin 04 to Arduino pin 12  LCD pin 05 to GND  LCD pin 06 to Arduino pin 11  LCD pin 11 to Arduino pin 5  LCD pin 12 to Arduino pin 4  LCD pin 13 to Arduino pin 3  LCD pin 14 to Arduino pin 2  [If backlight is needed] LCD pin 15 to +5V  [If backlight is needed] LCD pin 16 to GND via 220ohm resistor  khttp://github.com/LeventErkok/hArduino/raw/master/System/Hardware/Arduino/SamplePrograms/Schematics/LCD.png ^The happy glyph. See >( for details on how to create new ones. _The sad glyph. See >( for details on how to create new ones. `=Access the LCD connected to Arduino, making it show messages J we read from the user and demonstrate other LCD control features offered  by hArduino. ]^_`]^_`]^_`]^_`  experimentalerkokl@gmail.comNonea:Computes the amount of time a push-button is connected to A input pin 2 on the Arduino. We will wait for at most 5 seconds, D as a further demonstration of the time-out facility. Note that the D timing is done on the host side, so this measurement is inherently  inaccurate. @The wiring is straightforward: Simply put a push-button between 5 digital input 2 and +5V, guarded by a 10K resistor:  mhttp://github.com/LeventErkok/hArduino/raw/master/System/Hardware/Arduino/SamplePrograms/Schematics/Pulse.png aaaa  experimentalerkokl@gmail.comNonebPSend pulses on a led as requested by the user. Note that the timing is computed R on the host side, thus the duration of the pulse is subject to some error due to % the Firmata communication overhead.  Wiring: Simply a led on pin 13:  mhttp://github.com/LeventErkok/hArduino/raw/master/System/Hardware/Arduino/SamplePrograms/Schematics/Blink.png bbbb experimentalerkokl@gmail.comNonecIConnections for the Texas Instruments 74HC595 shift-register. Datasheet:  .http://www.ti.com/lit/ds/symlink/sn74hc595.pdf. L In our circuit, we merely use pins 8 thru 12 on the Arduino to control the C, O, E, F, and G b lines, respectively. Since we do not need to read the output of the shift-register, we leave the bits field unconnected. dQSeven-segment display demo. For each key-press, we display an equivalent pattern T on the connected 7-segment-display. Note that most characters are not-mappable, so O we use approximations if available. We use a shift-register to reduce the pin 9 requirements on the Arduino, setting the bits serially. Parts: R The seven-segment digit we use is a common-cathode single-digit display, such as  TDSG5150 ( *http://www.vishay.com/docs/83126/83126.pdf), or Microvity' s IS121, U but almost any such digit would do. Just pay attention to the line-connections, 6 and do not forget the limiting resistors: 220 ohm's should do nicely. 2 The shift-register is Texas-Instruments 74HC595:  .http://www.ti.com/lit/ds/symlink/sn74hc595.pdf. i Make sure to connect the register output lines to the seven-segment displays with the corresponding ' letters. That is, shift-registers Q_A) (Chip-pin 15) should connect to segment A; Q_B (Chip-pin 1)  to segment B., and so on. We do not use the shift-register Q_H' (Chip-pin 9) in this design.  thttp://github.com/LeventErkok/hArduino/raw/master/System/Hardware/Arduino/SamplePrograms/Schematics/SevenSegment.png cdcdcdcd experimentalerkokl@gmail.comNoneeZControl a servo, by executing user requests of blade movement. We allow 3 user commands:  l to swipe from angle-0 to 180;  r to swipe from angle-180 to 0;  Or any number between 0 to 1800, which puts the servo to the desired position. ^Almost any servo motor would work with this example, though you should make sure to adjust min/max pulse durations  in the Ug command to match the datasheet of the servo you have. In this example, we have used the HS-55 feather  servo ( 2http://www.servocity.com/html/hs-55_sub-micro.html3), which has the values 600 to 2400 micro-seconds. To connect the servo to the Arduino, simply connect the VCC (red) and the GND (black) appropriately, and the signal line (white) - to any SERVO capable pin, in this example we're using pin number 9:  mhttp://github.com/LeventErkok/hArduino/raw/master/System/Hardware/Arduino/SamplePrograms/Schematics/Servo.png f`Control a servo, as guided by the input read from a potentiometer. The set-up is similar to the e example q above, except instead of querying the user for the angle, we use the readings from a potentiometer connected to e analog input number 2. We used a 10 KOhm potentiometer, but other pots would work just as well too:  shttp://github.com/LeventErkok/hArduino/raw/master/System/Hardware/Arduino/SamplePrograms/Schematics/ServoAnalog.png efefefef !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWWXYZ[\]^_`abcdefghijklmn o p q r s t u v vwxyz1{|}~b     A !"#$%&'()*i+ hArduino-0.4/System.Hardware.Arduino.Parts.SevenSegmentCodesSystem.Hardware.Arduino!System.Hardware.Arduino.Parts.LCD,System.Hardware.Arduino.Parts.ShiftRegisters#System.Hardware.Arduino.Parts.Servo-System.Hardware.Arduino.SamplePrograms.Analog,System.Hardware.Arduino.SamplePrograms.Blink-System.Hardware.Arduino.SamplePrograms.Button.System.Hardware.Arduino.SamplePrograms.Counter/System.Hardware.Arduino.SamplePrograms.Distance*System.Hardware.Arduino.SamplePrograms.LCD.System.Hardware.Arduino.SamplePrograms.PulseIn/System.Hardware.Arduino.SamplePrograms.PulseOut3System.Hardware.Arduino.SamplePrograms.SevenSegment,System.Hardware.Arduino.SamplePrograms.ServoSystem.Hardware.Arduino.UtilsSystem.Hardware.Arduino.Data System.Hardware.Arduino.ProtocolSystem.Hardware.Arduino.CommSystem.Hardware.Arduino.FirmataSystem.Hardware.Arduino.Partschar2SSArduino LCDController Hitachi44780lcdRSlcdENlcdD4lcdD5lcdD6lcdD7lcdRowslcdCols dotMode5x10PinModeI2CSHIFTSERVOPWMANALOGOUTPUTINPUTPinpindigitalanalog withArduino queryFirmwaredelaytimetimeOut setPinMode digitalWritepullUpResistor digitalReadwaitForwaitAny waitAnyHigh waitAnyLowpulsepulseOut_hostTimingpulseIn_hostTiming analogReadsetAnalogSamplingInterval LCDSymbol lcdRegisterlcdWritelcdClearlcdHome lcdSetCursorlcdScrollDisplayLeftlcdScrollDisplayRight lcdBlinkOff lcdBlinkOn lcdCursorOff lcdCursorOn lcdDisplayOff lcdDisplayOnlcdLeftToRightlcdRightToLeftlcdAutoScrollOnlcdAutoScrollOfflcdFlashlcdCreateSymbollcdWriteSymbollcdInternalSymbol SR_74HC595serialnEnablerClocksClocknClearmbBits ShiftRegistersizename dataSheet initializedisableenableclearpushstorereadServoattachsetAngle analogValblinkbuttoncountermicroSecondsToCentimetersdistancehitachihappysadlcdDemo pulseDemosr sevenSegmentservo servoAnalogmkDebugPrintershowByte showByteListshowBin getStringfromArduinoBytestoArduinoBytes word2Bytes bytes2Wordsbase Data.MaybeNothingGHC.WordWord8SysExCmdSYSEX_REALTIMESYSEX_NON_REALTIMESAMPLING_INTERVALREPORT_FIRMWARE I2C_CONFIG I2C_REPLY I2C_REQUEST SHIFT_DATAPULSE STRING_DATA SERVO_CONFIGEXTENDED_ANALOGPIN_STATE_RESPONSEPIN_STATE_QUERYCAPABILITY_RESPONSECAPABILITY_QUERYANALOG_MAPPING_RESPONSEANALOG_MAPPING_QUERYRESERVED_COMMAND FirmataCmd SYSTEM_RESETPROTOCOL_VERSION END_SYSEX SET_PIN_MODE START_SYSEXREPORT_DIGITAL_PORTREPORT_ANALOG_PINDIGITAL_MESSAGEANALOG_MESSAGE ArduinoStatemessagebailOutport firmataID boardState deviceChannel capabilities listenerTid BoardStateboardCapabilitiesanalogReportingPinsdigitalReportingPins pinStatesdigitalWakeUpQueuelcdsLCDDatalcdDisplayModelcdDisplayControl lcdGlyphCount lcdControllerLCDPinDataBoardCapabilitiesPinCapabilitiesanalogPinNumber allowedModes ResolutionResponse Unimplemented PulseResponse AnalogMessageDigitalMessage AnalogMapping CapabilitiesFirmwareRequestPulseSamplingIntervalAnalogPinWriteDigitalPortWrite AnalogReport DigitalReport SetPinModeAnalogMappingQueryCapabilityQuery QueryFirmware SystemResetIPinPortportNopinPort pinPortIndexdebugdie getPinModes getPinDatacomputePortData digitalWakeUp firmataCmdVal getFirmataCmd sysExCmdValgetSysExCommandregisterPinModegetRemovalActionsgetModeActionsgetInternalPinconvertAndCheckPinpinModepinValue InternalPinpinNoMixedPin AnalogPin DigitalPin userPinNo$fShowBoardCapabilities$fShowResponse $fShowIPin $fShowPin $fShowPortsysExnonSysExpackageunpackageSysExunpackageNonSysExgetCapabilitiesghc-prim GHC.TypesFalsesendrecv recvTimeOut setupListenerTrue waitGenericHitachi44780Mask LCD_ENTRYLEFTLCD_ENTRYSHIFTINCREMENT LCD_DISPLAYON LCD_CURSORON LCD_BLINKONCmd getCmdValinitLCD getControllersendCmdsendData pulseEnabletransmitwithLCDupdateDisplayDataupdateDisplayControlupdateDisplayModemaskBit clearMasksetMaskLCD_SETCGRAMADDRLCD_CURSORSHIFTLCD_SETDDRAMADDRLCD_RETURNHOMELCD_ENTRYMODESETLCD_CLEARDISPLAYLCD_DISPLAYCONTROLLCD_FUNCTIONSETLCD_INITIALIZE_ENDLCD_INITIALIZE fallingEdge$fShiftRegisterSR_74HC595servoPinminPulsemaxPulse