[Home]AutoType Automata

HomePage | RecentChanges | Preferences | My Website home page

Using an Auto Type Automata

A simple Automata could be added to and Application to inject keystrokes, to a two port system.

A simple Play Script could be read by the Automata and inject keystrokes as if typed by the user or received from the remote end.

 < Hello How and I help?

 >  I would like to order a widget holder

 < what size would you like?

Each line would be directed to be injected at the interface.

 < interface is from the far end

 > interface is from the near end.

A method to start it and stop it would be needed.

Each character in the line above would be typed as if typed by a real person.

It can be used to soak test the Application and try out different ideas.

Leaky Bucket Adaptive Rate Control Automata

Some of the theory is similar to the leaky bucket adaptive rate control automata.

Integration And Feedback

You monitor a source, and filter the signal and measure the energy and smooth it.

There are many ways to combine the different outputs which I explore on my page.

It would be better if the AutoType devices could monitor the text from the other end.

http://www.dougrice.plus.com/dev/DigiSpark/text3.html - there are more notes about what to add to the bucket.

http://www.dougrice.plus.com/Erlangs/RateSimulator.htm has a leaky bucket demonstrated on a web page.

http://www.dougrice.plus.com/Erlangs/loadShareTry.htm - uses a Leaky Bucket to pick a destination based on preportions

http://www.dougrice.plus.com/Erlangs/loadShare.htm - used

Using two processes to form an ASTABLE

Run two parallel processes to form an astable.

While typing, assert an output, on the other process hold off starting if the other one is typing.

http://www.dougrice.plus.com/dev/DigiSpark/text4.html

Using an Auto Type Automata

Code in my Webpage could be used.

http://www.dougrice.plus.com/dev/DigiSpark/text2.html

It uses a timer to run a time slice.

Timer ticks are quantised, increment real time with a much finer quantization.

Real time is incremented in parallel and when it over flows a character in injected at the correct interface.

http://www.dougrice.plus.com/hp/Theory/cg6.htm shows the Catch Up Call Generator. This can be used for multiple sources all clocked from one timer.

Using cscript or wscript on Windows PC

It has been possible to use cscript to press keys but there is very little control.

once started, you need to wait for the script to end.

http://www.dougrice.plus.com/dev/DigiSpark/How_app.js.txt

 /*
  *
  *
  * How_app.js - Key Pressing script, based on one to automate the EUA
  *
  * Automating typing into the App using Windows shell scripts and javascript.* 
  *
  * https://msdn.microsoft.com/en-us/library/8c6yea83(v=vs.84).aspx
  * https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/windows-scripting/8c6yea83(v=vs.84)
  *
  *   wscript How_app.js  
 /*

http://www.dougrice.plus.com/dev/DigiSpark/How_app_Tests.js.txt

Using JAVA robot

Java robot provides a way to drive the keyboard and mouse. It can also sample the screen.

It is not possible to ask where a window is on the screen.

http://www.dougrice.plus.com/dev/javaTries/euan.java.txt

Using a count down state machine

A count down state machine uses a state variable that is decremented each timeslice.

It can be triggered and a periodic time slice is used to animate it. At the end it can disable itself.

The count can be adjusted depending on inputs.

Functions:-

 trigger()
 timeslice()

Example:- A chiming clock needs to strike the hours.

  A weight provides power to run the count down state machine.

  trigger() sets countdown to number of bongs required. 

  timeslice() is run every second.

  if countdown is greater than 0 decrement and strike bell 
  if countdown is zero signal end and disable.

Example:- A monostable that flashes a sequence

  trigger() sets countdown to number of flashes required, and loads pattern required.

  timeslice() is run every second.

  if countdown is greater than 0 decrement and flash LED. Maybe a pattern is used 
  if countdown is zero signal end and disable.

More notes on the Digispark keyboard

https://github.com/digistump/DigisparkArduinoIntegration/blob/master/libraries/DigisparkKeyboard/DigiKeyboard.h

The DigiSpark and RaspberryPi Keyboard do Key presses, not Ascii

  size_t write(uint8_t chr) {
    uint8_t data = pgm_read_byte_near(ascii_to_scan_code_table + (chr - 8));
    sendKeyStroke(data & 0b01111111, data >> 7 ? MOD_SHIFT_RIGHT : 0);
    return 1;
  }

There is a look up to convert ASCII to Keycodes.

DigisparkArduinoIntegration/libraries/DigisparkKeyboard/scancode-ascii-table.h

  1. include <avr/pgmspace.h>
// Lookup table to convert ascii characters in to keyboard scan codes // Format: most signifficant bit indicates if scan code should be sent with shift modifier // remaining 7 bits are to be used as scan code number.

RaspberryPico Keyboard

https://github.com/arduino/ArduinoCore-mbed/tree/main/libraries/USBHID/examples

libraries/USBHID/src/USBKeyboard.h

https://github.com/arduino/ArduinoCore-mbed/blob/main/libraries/USBHID/src/USBKeyboard.cpp

the "\n" is converted to key code

  #ifdef US_KEYBOARD
  /* US keyboard (as HID standard) */
  #define KEYMAP_SIZE (164)
  const KEYMAP keymap[KEYMAP_SIZE] = {
    {0, 0},             /* NUL */
    {0, 0},             /* SOH */
    {0, 0},             /* STX */
    {0, 0},             /* ETX */
    {0, 0},             /* EOT */
    {0, 0},             /* ENQ */
    {0, 0},             /* ACK */
    {0, 0},             /* BEL */
    {0x2a, 0},          /* BS  */  /* Keyboard Delete (Backspace) */
    {0x2b, 0},          /* TAB */  /* Keyboard Tab */
    {0x28, 0},          /* LF  */  /* Keyboard Return (Enter) */
    {0, 0},             /* VT  */
    {0, 0},             /* FF  */
    {0, 0},             /* CR  */
    {0, 0},             /* SO  */
    {0, 0},             /* SI  */


HomePage | RecentChanges | Preferences | My Website home page
This page is read-only | View other revisions
Last edited September 15, 2024 9:00 pm by dougrice.plus.com
Search: