,

Interface and Application Programming

Write an application that interfaces with an input &/or output device that you made

 

MyOInterface

In the Assignment I want to make an Interface of my Input device , in order to show the patient the maximal values and the minimal values that he can achieve with the Myoware sensor.

I tried to understand the communication between Processing and Arduino , and also because it work with serial communication. Something related to the last assignment Networking. For better understanding you can look for more information in the tutorial from Sparkfun Connecting Arduino to Processing

Thumbnail Image 1

Serial Comunication from AC2016 and the commputer.

In the last time I had a simple problem that caused more that want wrong trials TX is connected with the RX and vice versa in order to establish the serial communication between the computer(FTDI Cable) and the Gyro SK. In this time I have a new problem my I connected the reset Cable in the reset pin header of the of the GYRO SK in this case the RESET Cable is connected in the SDA from Gyro SK

Thumbnail Image 1

Arduino IDE code:

 

I wanted to simplify a little bit my code and also take the interaction of the input, it means the Myo biceps.

BICEPS_PIN= A2; MYO_TRICEPS_PIN = A1;

IMPORTANT: we have to print the values of the sensor in order to represent them in the processing program. And adding a delay for making a new lectures of the values.

 

In the Processing sketch:

We have to integrate the processing. Serial library And establish the port. For iOS operative system you can not see directly the com in this case you can ad this line : String portName = Serial.list()[5]; port = new Serial(this, portName, 9600);

Thumbnail Image 1

.Void Draw

I use the Text: textSize(32); text("word", 10, 30); fill(0, 102, 153);

“Draws text to the screen. Displays the information specified in the first parameter on the screen in the position specified by the additional parameters. A default font will be used unless a font is set with the textFont() function and a default size will be used unless a font is set with textSize(). Change the color of the text with the fill() function. The text displays in relation to the textAlign() function, which gives the option to draw to the left, right, and center of the coordinates”. Processing 2016.

Thumbnail Image 1

Triangle

triangle: triangle(x1, y1, x2, y2, x3, y3) .

“A triangle is a plane created by connecting three points. The first two arguments specify the first point, the middle two arguments specify the second point, and the last two arguments specify the third point”. Processing 2016

Thumbnail Image 1

.

In this time I have a new problem my I connected the reset Cable in the reset pin header of the of the GYRO SK in this case the RESET Cable is connected in the SDA from Gyro SK

Thumbnail Image 1

Trial!

The scketch didn't work!

Thumbnail Image 1

Working with the color +  MyOSignal

In the triangle part I did a changed color using the red aas a maximal color of the MyOSignal Values.

Thumbnail Image 1

.

going to RED !!

Thumbnail Image 1

Color Selector

TIPP: to select a color you can find the code RGB code of the color in the in the panel tools > color selector. An play with the color. In the code you can see that the 255 , 0, 0 is the pure red , in this case I put higher values - MyOSignal, to generate a green color in the begin and transforming it in red in the top of the values.

Thumbnail Image 1

Connection MyoWare + AC2016

sending the data to the interface.

Programming

//Arduino Data
//AC 2016

int MYO_BICEPS_PIN= A2;
int MYO_TRICEPS_PIN = A1;
void setup()
{
  //Create Serial Object (9600 Baud)
  Serial.begin(9600);
}

void loop()
{
  int myoValueBiceps = map(analogRead(MYO_BICEPS_PIN), 0, 1023, 0, 255);
  Serial.println(myoValueBiceps);
  int val1 = map(analogRead(potPin2), 0, 1023, 0, 255);
  Serial.println(val1);
 
  delay(50);

  }
                    
//Processing Data. 
//AC 2016

import processing.serial.*;
Serial port;
float MyOSignal = 0;


void setup()
{
  size(400,400);
 String portName = Serial.list()[5];
port = new Serial(this, portName, 9600);
 port.bufferUntil('\n');  
 
  
}

void draw()
{
  background(250,250,250);
  fill( MyOSignal, 200 - MyOSignal, 150- MyOSignal);
  triangle(0, 400, 400, 400, 200 ,350 -MyOSignal);
  fill(0, 102, 153);
  textSize(32);
  
  text("400", 10, 30);
  text("300", 10, 100);
  text("200", 10, 200); 
  text("100", 10, 300);
 
}
  
void serialEvent (Serial port)
{
  MyOSignal = float(port.readStringUntil('\n'));
  //brightness1 = float(port.readStringUntil('\n1'));
}
                    

a lot of tools to descover !