Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.portnomenclature #52

Open
EloiStree opened this issue Jan 16, 2021 · 0 comments
Open

.portnomenclature #52

EloiStree opened this issue Jan 16, 2021 · 0 comments

Comments

@EloiStree
Copy link
Owner

EloiStree commented Jan 16, 2021

(This post is under construction and is hard to understand until it is done. But this is very useful. Keep it up and you will enjoy the tool)


Open Macro Input is about allowing actions based on open input ways... So Arduino, or else, is a must.

This file extension is my way of doing it.

This file extension allow you to define a serial port to listen.
(Serial port can be USB or Bluetooth on Window)

The requirement is that your Arduino communication through port in a specific way.

For Example:

#01010|2492\n

Format:

#Digial Inputs from 0-1|Analogic Inputs from 0-9
#01234|0123\n

The example is saying:

  • that the boolean value at the index 1 and 3 are considered as active on the five used
  • all analogic value are used but the index 3 is highly active on the four used

Note: we are talking about index and not "pin".
My aim is to have abstraction between hardware and software.
For example:

  • the pin 2 and 4 could be creating the index 0
  • the pin 1 and pin 3 could be creating the analog 2
  • every seconds you could be switching index 1
  • ...

Note: why is it compressed ?
Bluetooth and USB has a bandwidth that can be small.
The impacts of none compress data:

  • less devices can be connected by Bluetooth
  • the time between "frame" become longer
  • and you slow the reading program thread.

For example, here is what I use with my "four buttons foot board"

Send by the Arduino
#0000|

Translation in the OMI software

<?xml version="1.0" encoding="utf-8"?>
<AnalogDigitalCompressConfig>
  <PortConnections>
    <PortConnection portId="20" patternName="Footboard" />
  </PortConnections>
  <AnalogDigitalCompressPatterns>
     <AnalogDigitalCompressPattern name="Footboard" docUrl="">
      <digit index="0" label="FootRD" />
      <digit index="1" label= "FootLT" />
      <digit index="2" label= "FootRT" />
      <digit index="3" label= "FootLD" />
    </AnalogDigitalCompressPattern>
  </AnalogDigitalCompressPatterns>
</AnalogDigitalCompressConfig>

The code will register the serial port number 20 and convert the index 0-3 to boolean named FootRD-FootLT that you can use as easy as other input like keyboard.

Basic example of what it can look like on Arduino in quick code version:

 int buttonCount =4;
 int buttonPin[] = {33,35,37,39}   ;

void setup() {
  Serial.begin(9600);
  for(int i=0; i< buttonCount;i++){
      pinMode(buttonPin[i], INPUT_PULLUP);
  }
}

void loop() {
  Serial.println("");
  Serial.print("#"); 
  for(int i=0; i< buttonCount;i++){
    int v= digitalRead(buttonPin[i]);
    Serial.print( v==0?"1":"0");
  }
  Serial.print("|");
  delay(10);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant