Welcome to %s forums

BrainModular Users Forum

Login Register

usine with arduino

General Discussion about whatever fits..
Post Reply
joffo78
Member
Posts: 1033
Contact:

Unread post by joffo78 » 02 Feb 2016, 17:19

Hello
I need to build a little basic trigger with 8 possibilities (buttons or knob) that could be hide on a wardrobe.
I think to make in with arduino. I manage to find a code (on the wiki page) to receive one value with the serial module in usine.
But it seems to me more complex if i'd like to receive several values on the same time.
Any experience ?
Thanks
JF

User avatar
rlgsbt
Member
Posts: 187
Location: Marseille
Contact:

Unread post by rlgsbt » 03 Feb 2016, 07:30

Hi,
You can use the fonction "map" to split the analog inputs.

Code: Select all

void loop() {
  // read the input on analog pin 0:
  int sensor1Value = analogRead(A0);
  // print out the value you read:
  Serial.println(sensor1Value);
  delay(10);        // delay in between reads for stability
  
    // read the input on analog pin 1:
  int sensor2Value = analogRead(A1);
  // transform values from 0-1023 to 2000-3023 
  sensor2Value = map(sensor2Value, 0, 1023, 2000, 3023);
  // print out the value you read:
  Serial.println(sensor2Value);
  delay(10);        // delay in between reads for stability
  
      // read the input on analog pin 2:
  int sensor3Value = analogRead(A2);
  sensor3Value = map(sensor3Value, 0, 1023, 4000, 5023);
  // print out the value you read:
  Serial.println(sensor3Value);
  delay(10);        // delay in between reads for stability
then in Usine, all datas between 0-1023 are coming from A0, datas between 2000-3023 are coming from A1, etc.
SB

User avatar
oli_lab
Member
Posts: 1263
Location: Brittany, France
Contact:

Unread post by oli_lab » 04 Feb 2016, 10:33

you can as well use a Teensy in USBMIDI, more straigth forward than comport IMHO

Olivar
http://oli-lab.org

Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces

follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social

Post Reply

Who is online

Users browsing this forum: No registered users and 34 guests