Automated Typing demo - InterConnected DigiSpark & ATMEGA32U4 boards:- Arduino Leonardo, Bad Beetle Pro Microboards.

The Digispark can be configured as a HID Keyboard. Also ATMEGA32U4 boards:- Arduino Leonardo, Bad Beetle Pro Micro, OTG connectors and cables and a Wire to disable typing, can be used. Useful for auto testing a typing app.

Arduino Sketches:-

Keyboard_button3.ino

LeonardoAutoType.ino

Arduino Sketches:-

My AutoTyping kit. DigiSpark, ATMEGA32U4 boards:- Arduino Leonardo, Bad Beetle Pro Micro, OTG connectors and cables and a Wire to disable typing. :-

image

Introduction:-

This page explores a peer to peer protocol , but pragmatically a master slave protocol is simpler.

It has a USB port for the HID and three pins.

There are three pins P0, P1, P2. P1 has an LED so in an output.

We want an ASTABLE - when one end is typing, the other end backs off. Turn the LED on when Typing, if the other end has LED on, back off typing.

if one is the master and the other the slave connect P0 on the slave to P1 on the master

Explore peer to peer so

----|----|----|----|----|----|----|----|----|----|----|----|

              +---------+       
              |DigiSpark|
    +---------| P2      |==> USB HID keyboard
    | +-------| P1 LED  |
    | |  +----| P0 I/P  |  
    | |  |    +---------+   
    | |  +-- /DISABLE      P0 is used to disable typing  
    | |                    P1 is LED output  
    | |                    P2 is Fast / slow      
    | |  +-- /DISABLE   
    | |  |    +---------+       
    | |  |    |DigiSpark|
    | |  +----| P0      |
    +---------| P1 LED  |
      +-------| P2 I/P  |==> USB HID keyboard
              +---------+       

enable pullups on the inputs.

----|----|----|----|----|----|----|----|----|----|----|----|

The units type either fast or slow. When TYPING turn on the LED

LED __^---  Start of typing - back off 
LED --v___  GA  invitation to start typing 

There is a deadlock if both ends are not typing and the LED is off.
So run a watch dog timer and pulse LED if it matures to kick other end. 

Pragmatically it is easier to let them free run. 
set up different text at each so the loop takes a different time.

ELSE alternatively let one be the master and the other slave.
On the slave enable typing when the master is not.

"1" --- [ p0 master p1] --- [ p0 slave p1 ] ---


DigiSpark 1: Text to be typed.

ds1_P0
ds1_P2 connected to ds2_P1
else ds1_P2 = 1 / 0
HID_1:


DigiSpark 2: Text to be typed.

ds2_P0
ds2_P2 connected to ds1_P1
else ds2_P2 = 1 / 0
HID_2:


combined_app:

combined:


combined_words:


combined_paragraphs:


thoughts

There are two streams to be displayed together.

Options:

Display two lines:- received, transmitted.

Merge characters as they arrive.

Merge Words as they arrive.

Merge ParaGraphs as they arrive.

Add time Markers so split on.

The input needs to be display at least word by word.


Flushed
1:hsgdhsgdhs
2:khasahsksahk
---------------------			
Line1: jwhej kjwejk kjwhejkwle l
Line2: kwh  ek jknmnm ljkljj 
--------------
When Line1 or Line2 get too big flush some text out to the Flushed buffer.
Build up string consisting of a list of app + TRA interleaved.

opStr = opLogStr+

Issues:-

You could draw a timeline as characters are received.

If people are overtyping, then the bubbles split.

If the bubbles are split on GA, then the Bubbles can overlap in time.

A--[ txBuffer ]----
B--[ rxBuffer ]----

===================
stream Timeline:-
===================
A--[ HI GA ]-----------------[Hello     ]-----[Hello     ]---[aaaaaaaaaaa]--------[ddddddd]--
B----------------[ HI GA ]-----[Hi]---------[hhhhhhhhhhhhh]----[bbbbbbbbbbb]---[ccccccc]----

So do you have bubbles that are not overlapping, that overlap. If they overlap, does the text go at the start, middle, end?