Quantcast
Channel: Arduino - Processing 2.x and 3.x Forum
Viewing all 747 articles
Browse latest View live

No being able to use Arduino with processing on Mac

$
0
0

Hi there,

I am a beginner and I am currently working on an arduino projects that requries some coding on processing. Supposingly when I type in my code in both arduino and processing like this, I would be able to change the color of the picture using the potentiometer on arduino. 屏幕快照 2016-02-24 下午2.29.10

However, when I compiled successfully and down the program to my arduino uno, it just wont work! I've check my circuit and code and they have no problem. I observed that all of the PCs in our class had no prblem of getting it to work. I am curious that if it has some thing differently to do with Mac?

I am really confused and please help me:)


Arduino and Processing

$
0
0

I have the arduino and ultrasonic HC-SR04. I want to help please us. The arduino want to measure the distance and what gives the serial. Communicates with the processing and when the distance is greater than 150cm displays an image, if less playing video. My problem is that I run the processing but the video plays either away or close. Please help me. I beginner!!

Arduino is from a library NewPing // --------------------------------------------------------------------------- // Example NewPing library sketch that does a ping about 20 times per second. // ---------------------------------------------------------------------------

#include <NewPing.h>

#define TRIGGER_PIN  12  // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN     11  // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 400 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.

void setup() {
  Serial.begin(115200); // Open serial monitor at 115200 baud to see ping results.
}

void loop() {
  delay(50);                      // Wait 50ms between pings (about 20 pings/sec). 29ms should be the shortest delay between pings.
  unsigned int uS = sonar.ping(); // Send ping, get ping time in microseconds (uS).
  Serial.print("Ping: ");
  Serial.print(uS / US_ROUNDTRIP_CM); // Convert ping time to distance and print result (0 = outside set distance range, no ping echo)
  Serial.println("cm");
}

Processing

// Video
import processing.video.*;
Movie movie;

// Image
PImage img;  // Declare variable "a" of type PImage

// Serial
import processing.serial.*;
Serial myPort;  // Create object from Serial class
int val;      // Data received from the serial port


void setup() {
  size(640, 360);
  background(0);

  printArray(Serial.list());
  String portName = Serial.list()[1];
  myPort = new Serial(this, portName, 115200);

  // Load and play the video in a loop
  movie = new Movie(this, "transit.mov");
  movie.loop();
  img = loadImage("moonwalk.jpg");  // Load the image into the program
}

void movieEvent(Movie m) {
  m.read();
}

void draw() {
  if (movie.available() == true) {
    movie.read();
  }
  image(movie, 0, 0, width, height);

  if ( myPort.available() > 0) {  // If data is available,
    val = myPort.read();         // read it and store it in val
  }


  if (val>130) {
    image(img, 0, 0);
  } else {
    image(movie, 0, 0, width, height);
  }
  println(val);
}

Admob integratoin with processing 3

$
0
0

Hi There!

Is there a way to integrate admob into sketches in processing 3(for android, I'm using mac), It was kind of working in processing 2 and not now for me. Just not able to get through it. Is there a way out? any help appreciated. Thanks in advance.

Ramon64917021

$
0
0

Estoy intentando cargar un programa y en el momento de verificarlo me salen un montón de errores de los que no entiendo nada. Además no se nada de inglés.

¿Alguien me puede ayudar?

Gracias y perdón por las molestias

 const int inPin = A0;  // pin de entrada
 const int ledPin = 13; // pin del led
 int val = 0;
 void setup(); {
    pinMode(ledPin, OUTPUT);
    Serial.begin(9600);
 }
 void loop() {
    val = analogRead(inPin); // se lee el valor del pin de entrada
    digitalWrite(ledPin, HIGH); // enciende el led
    delay(val); // espera el valor leído en la entrada en milisegundos
    digitalWrite(ledPin, LOW); // apaga el led
    delay(val); // espera el valor leído en la entrada en milisegundos
    int sensorValue = analogRead(inPin); // leemos el valor
    delay(1);   // pausa para estabilidad entre ciclos
 }


 map() {
    int x = 11;
    int y = constrain(x,0,10,); // y tendra valor 10
    int z = constrain(x,0,100); // z tendrá valor 11 por estar entre los limites
 }

}

Arduino:1.6.6 Hourly Build 2015/07/15 12:54 (Windows 8.1), Placa:"Arduino Uno"

sketch_feb27b:21: error: macro "constrain" passed 4 arguments, but takes just 3
sketch_feb27b:4: error: expected unqualified-id before '{' token
sketch_feb27b:19: error: ISO C++ forbids declaration of 'map' with no type [-fpermissive]
sketch_feb27b.ino: In function 'int map()':
sketch_feb27b:21: error: 'constrain' was not declared in this scope
sketch_feb27b.ino: At global scope:
sketch_feb27b:24: error: expected declaration before '}' token
macro "constrain" passed 4 arguments, but takes just 3

This report would have more information with "Show verbose output during compilation" activala desde Archivo > Preferencias

convert my computers audio signal (via FFT?) into a serial signal usable for my Arduino code

$
0
0

Hey guys, i´m a processing noob so i would like to know, how to configure my processing 3 to grab my audiosignal and convert it ( maybe with FFT; i dont understand this) into a signal usable for my arduino (COM 6 connection). I need 3 frequence spectra for the left and right audiochannel.

Is it possible to grab the audiosignal through the software rather than using microphones? I hope you understand me( sorry for my bad english). If there are any questions please leave a comment.

Communication with arduino needs speed improvement(linefeed, header).

$
0
0

Hello,

I made an processing android mode app which is simply receiving data from an arduino via bluetooth. Got an arduino with a hc-05 bluetooth module and an hall sensor running. This arduino is sending an H as header, km/h, distanceand a linefeed:

Serial.print('H');
Serial.print(",");
Serial.print(KMH,2);
Serial.print(",");
Serial.print(DIST,DEC);
Serial.print(",");
Serial.println(); // CR/LF senden

I receive the data with the android mode sketch very slow (sometimes it takes 3sec until value is refreshed). I think this problem is related to " if ((char)data[data.length-1]=='\n') dataEnd = true;", but its needed to identify my data clearly. When i´m only text/print (log) the value of data i can see data comming in from the arduino very fast.

void onBluetoothDataEvent(String who, byte[] data)
    {
        for (int i=0; i<data.length; i++ ) {
        echoArduino +=String.valueOf((char)data[i]);
        }
       if ((char)data[data.length-1]=='\n') dataEnd = true;
       if (dataEnd) {
       feedbackArdu = split(echoArduino, ',')[0];
      sensorArdu = split(echoArduino, ',')[1];
      echoArduino="";
        dataEnd = false;
      }
    }

The whole android mode Sketch:

import processing.core.PFont;
import android.os.Bundle;
import ketai.net.bluetooth.*;
import android.content.Intent;
import ketai.net.bluetooth.*;
import ketai.ui.*;
import ketai.net.*;
KetaiBluetooth bt;
KetaiList klist;
String info = "";
ArrayList<String> devicesDiscovered = new ArrayList();
boolean isConfiguring = true;
String UIText;
char HEADER = 'H'; // Zeichen zur Identifikation des Anfangs einer Nachricht
short LF = 10; // ASCII-Linefeed
byte ardudata;
String str1;
float kmhArduino;
int distArduino;
int siebenArduino;
PFont font;
short portIndex = 0; // com-Port wa¨hlen, 0 ist der erste Port
boolean dataEnd = false;
String echoArduino = "";
// Datenstring mit den Servowerten, der als Byte Array konvertiert über die Schnittstelle gesendet wird.
String datenString = "";
String feedbackArdu = "", sensorArdu = "";
//********************************************************************
// The following code is required to enable bluetooth at startup.
//********************************************************************
void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  bt = new KetaiBluetooth(this);
}

void onActivityResult(int requestCode, int resultCode, Intent data) {
  bt.onActivityResult(requestCode, resultCode, data);
}

void setup() {
  size(displayWidth, displayHeight);
  font = loadFont ("Arial-BoldMT-48.vlw");
  bt.start(); // BT Service starten.
  //***************************************************************
  // Hier muss die individuelle Adresse deines BT Moduls eingegeben werden.
  bt.connectDevice("98:D3:31:30:2C:04"); // HC-05 BT-Modul
  //***************************************************************
}
void draw() {
  background(255, 255, 255);
  fill(0, 0, 0);
  textFont(font, 60);
  text("Sk8tacho V0.1", 50, 100);
  textFont(font, 40);
  fill(0, 0, 0);
  text(feedbackArdu + "kmh", 100, 800);
  //text("Data:"+ardudata, 50, 700);
  text("Distance: " + sensorArdu + "m", 50, 1000);
  fill(0, 0, 0);
  textFont(font, 30);
  text("made by inventED 2016", 50, 1800);
}
    void onBluetoothDataEvent(String who, byte[] data) //Callback Methode: Es liegen Daten vom Arduino an der BT-Schnittstelle an.
{
  //Falls noch kein \n empfangen wurde, String vom Arduino also nicht nicht komplett empfangen.
  //if (!dataEnd) {
    //Byte Array elementweise in Char umwandeln und dem String hinzufügen.
    for (int i=0; i<data.length; i++ ) {
      echoArduino +=String.valueOf((char)data[i]);
    //}
  }

  //Wenn das letzte Zeichen ein \n war, ist String vom Arduino komplett empfangen worden.
  if ((char)data[data.length-1]=='\n') dataEnd = true;

  //Falls String vom Arduino komplett empfangen worden.
  if (dataEnd) {
  feedbackArdu = split(echoArduino, ',')[1]; // Substring vor dem ersten Komma heraustrennen
  sensorArdu = split(echoArduino, ',')[2];  // Substring zwischen ersten und zweiten Komma heraustrennen
  echoArduino=""; // Stingpufer zurück setzen.
    dataEnd = false; // Empfang des nächsten Strings ermöglichen.
  }
}

Anybody got an idea for another faster solution. Woulde be great! Or is something wrong in the skech?

Thank you.

sorry I´m new to coding.... and sorry for my english.

How to make a new bezier in processing on arduino button press?

$
0
0

Alright, I realize this is gonna be a little abstract but please bear with me;

I'm using this code:

    int pts = 4;
    int ptSize = 6;
    float[]x = new float[4];
    float[]y = new float[4];
    boolean[]isDragSafe = new boolean[4];

void setup(){
  size(300, 300);
  smooth();
  // fill coordinate arrays
  x[0] = x[1] =  50;
  x[2] = x[3] = width-50;
  y[0] = height/2-50;
  y[3] = height/2+50;
  y[1] = y[2] = height/2;

  //initialize dragging flags to false
  for (int i =0; i< pts; i++){
    isDragSafe[i] = false;
  }
}

void draw(){
  background(255);
  noFill();
  //draw curves and control handles
  strokeWeight(2);
  //spline curve
  stroke(0, 200, 30);
  curve (x[0], y[0],x[0], y[0], x[1], y[1], x[2], y[2]);
  curve (x[0], y[0], x[1], y[1], x[2], y[2], x[3], y[3]);
  curve (x[1], y[1], x[2], y[2], x[3], y[3], x[0], y[0]);
  //bezier curve
  stroke(0, 30, 200);
  bezier (x[1], y[1],x[0], y[0], x[3], y[3], x[2], y[2]);
  // draw bezier handles
  strokeWeight(1);
  stroke(100);
  line(x[0], y[0], x[1], y[1]);
  line(x[2], y[2], x[3], y[3]);
  // draw anchor/control points
  stroke(0);
  fill(0);
  for (int i =0; i< pts; i++){
    if (i ==0 || i==3){
  fill(255, 100, 10);
  rectMode(CENTER);
  rect(x[i], y[i], ptSize, ptSize);
    }
    else {
  fill(0);
  ellipse(x[i], y[i], ptSize, ptSize);
    }
  }

  // start dragging if flag true
  for (int i =0; i< pts; i++){
    if (isDragSafe[i]){
  x[i] = mouseX;
  y[i] = mouseY;
    }
  }
}

// release any point attached to the mouse
void mouseReleased (){
  for (int i =0; i< pts; i++){
    isDragSafe[i] = false;
  }
}

// for dragg'n dem points
void mousePressed (){
  for (int i =0; i< pts; i++){
    if (mouseX>=x[i]-5 && mouseX<=x[i]+ptSize+5 &&
  mouseY>=y[i]-5 && mouseY<=y[i]+ptSize+5){
  isDragSafe[i] = true;
    }
  }
}

// show hand when over draggable points
void mouseMoved (){
  cursor(ARROW);
  for (int i =0; i< pts; i++){
    if (mouseX>=x[i]-5 && mouseX<=x[i]+ptSize+5 &&
  mouseY>=y[i]-5 && mouseY<=y[i]+ptSize+5){
  cursor(HAND);
    }
  }
}

What I want to do is connect an arduino to it, I want to use some potentiometers to change the value of the anchor/control points, this is not the problem; I know how to connect arduino to processing etc. But the next step is: I want to have a button, that when pressed, creates a new bezier, with new anchor/control points to control with the potmeters.

So you start off with one bezier (as the current code shows), then you can tweak the curve of the bezier, once you press the button, it creates a new bezier, connected to the old bezier, so you can continue your drawing.

The idea is that it'll be a drawing machine kind of thing with potmeters and fancy buttons and stuff. I've been googling some but I can't find any info on how to make it draw a new bezier, any help or pointers are appreciated! Thanks for reading.

Array Index out of bounds exception error.

$
0
0

Basically what im trying to do is to communicate an arduino with processing to graph the temperature.

Im sending this from arduino via serial :

Serial.print(superior); Serial.print(","); Serial.print(inferior); Serial.print(","); Serial.println(valor_sensor_enviar);

delay(2000);

pantallazo1

so I basically need to store "superior" and "inferior" and represent the third variable data which is continuosly changing between 50 and 0.

So I tried this :

import processing.serial.*;

Serial port;

int i,k; int temp; String buffer; int[] valor_anterior=new int[150]; int[] valor_auxiliar=new int[150]; int[] datos=new int[10]; int[] pdatos=new int[10]; int x=65; int nX=400,nY=400; int j; int valor_supeior; int valor_inferior; int saltodelinea=10;

void setup()
{

port = new Serial(this, Serial.list()[1], 9600); background(255);

size(700 ,400); }

void draw() { if(port.available()>=1){

            buffer = port.readStringUntil(saltodelinea);
            port.clear();
            if (buffer != null) {
            buffer = trim(buffer);
            datos = int(split(buffer, ','));
            }}}

It works for a short period of time and then crashes giving me the error in the title of this post. Ive been investigating about the error and it seems to be a problem of space in the array I declared. Actually im "SUPOSED" so save 3 INTs in a vector which has space for 10 of them, so why does it crash? Can anyone help me out?


Connecting to 32x32LED matrix

$
0
0

HI, I have a 32x32 array in Processing with some arbitrary functions. How do I display what I created in Processing on my 32x32 LED RGB matrix via the arduino?

The Processing code is show below:

`

int a,sCol,b;
int red = color(255,0,0);
int green = color(0,255,0);
int blue = color(0,0,255);
int yellow = color(255,247,3);
int cols = 32;
int rows = 32;
MyRect[][] grid = new MyRect[cols][rows];

void setup() {
  size (1000,800);

  smooth();
  for (int i =0; i < cols; i++) {
    for ( int j = 0; j< rows; j++) {
      grid[i][j] = new MyRect (i*21+20,j*21+20,20,20,i,j);
    }
  }


}

void draw() {
  background(#BCBCB8);







  noFill();
  stroke(0);
  rect(780,10,190,600);


  String s = "  Colour Pallet";
  stroke(#FFFFFC);
  fill(#9625E3);
  textSize(20);
  text( s, 800,40);

  String s1 = "Selected Colour";
  stroke(#FFFFFC);
  fill(#9625E3);
  textSize(20);
  text( s1, 800,330);


   String z = "LED property controller";
   stroke(#FFFFFC);
   fill(#9625E3);
   textSize(25);
   text( z, 220,720);





  fill(red);//(0,0,255);
  rect(850,70,40,40);
  fill(green);//(0,255,0);
  rect(850,120,40,40);
  fill(blue);//(255,0,0);
  rect(850,180,40,40);
  fill(yellow);
  rect(850,240,40,40);
  fill(sCol);
  rect(850,350,40,90);

  for (int i = 0; i < cols; i++) {
    for ( int j = 0; j< rows; j++) {
      grid[i][j].draw();
    }
  }
}

void mousePressed() {
  if (mouseX > 365) {
    a = get(mouseX,mouseY);
    if (a == red || a == green || a == blue || a == yellow) sCol = a;
  }


}

class MyRect {
  float x, y, wide, high, bi, bj;
  color b;

  MyRect(float x, float y, float wide, float high, float bi, float bj) {
    this.x = x;
    this.y = y;
    this.wide = wide;
    this.high = high;
    this.bi = bi;// column number
    this.bj = bj;// row number
    b = color(0);
  }

  void draw() {
    if(over()) {
      stroke(255,0,255);
      if(mousePressed) {
        if (mouseButton == LEFT) { b = sCol; }
        if (mouseButton == RIGHT) { b = color(0); }
      }
    } else { stroke(255); }
    fill(b);
    rect(x, y, wide, high);
  }

  boolean over() {
    if (mouseX >= x && mouseX <= x+wide &&
      mouseY >= y && mouseY <= y+high) {
      return true;
    }
    return false;
  }
}
`

for anyone wanting to test it, left click to select colour, right to remove.

processing the distance in a wave forum

$
0
0

Hi,

This is my code that I'm try to process the distance as a wave the code is working fine but when testing in processing 1.2.1 it don't seem to detect it

import processing.serial.*;

int numOfShapes = 60; // Number of squares to display on screen
int shapeSpeed = 2; // Speed at which the shapes move to new position
 // 2 = Fastest, Larger numbers are slower

//Global Variables
Square[] mySquares = new Square[numOfShapes];
int shapeSize, distance;
String comPortString;
Serial myPort;

// -----------------------Setup ---------------------------
void setup(){
 size(500,500); //Use entire screen size.
 smooth(); // draws all shapes with smooth edges.

 // Calculate the size of the squares and initialise the Squares array
 shapeSize = (width/numOfShapes);
 for(int i = 0; i<numOfShapes; i++){
 mySquares=new Square(int(shapeSize*i),height-40);
 }

 /** Open the serial port for communication with the Arduino
 Make sure the COM port is correct - I am using COM port 4 */
 myPort = new Serial(this,"COM4", 9600);
 myPort.bufferUntil('\n'); // Trigger a SerialEvent on new line

}

// ------------------------Draw -----------------------------
void draw(){
 background(0); //Make the background BLACK
 delay(50); //Delay used to refresh screen
 drawSquares(); //Draw the pattern of squares

}



// ---------------------serialEvent ---------------------------

void serialEvent(Serial cPort){
 comPortString = cPort.readStringUntil('\n');
 if(comPortString != null) {
 comPortString=trim(comPortString);

 /** Use the distance received by the Arduino to modify the y position
 of the first square (others will follow). Should match the
 code settings on the Arduino. In this case 200 is the maximum
 distance expected. The distance is then mapped to a value
 between 1 and the height of your screen */
 distance = int(map(Integer.parseInt(comPortString),1,200,1,height));
 if(distance<0){
 /** If computer receives a negative number (-1), then the
 sensor is reporting an "out of range" error. Convert all
 of these to a distance of 0. */
 distance =0;
 }
 }
}


// ---------------------drawSquares ---------------------------
void drawSquares(){
 int oldY, newY, targetY, redVal, blueVal;

 /** Set the Y position of the 1st square based on
 sensor value received */
 mySquares[0].setY((height-shapeSize)-distance);

 // Update the position and colour of each of the squares
 for(int i = numOfShapes-1; i>0; i--){
   // Use the previous square's position as a target
   targetY=mySquares[i-1].getY();
   oldY=mySquares.getY();

   if(abs(oldY-targetY)<2){
     newY=targetY; //This helps to line them up
   }
   else{
     // calculate the new position of the square
     newY=oldY-((oldY-targetY)/shapeSpeed);
   }
   // Set the new position of the square
   mySquares.setY(newY);

   /** Calculate the colour of the square based on its
   position on the screen */
   blueVal = int(map(newY,0,height,0,255));
   redVal = 255-blueVal;
   fill(redVal,0,blueVal);

   // Draw the square on the screen
   rect(mySquares.getX(), mySquares.getY(),shapeSize,shapeSize);

 }
}

// This puts processing into Full Screen Mode
boolean sketchFullScreen() {
 return true;
}

// ---------------------CLASS: Square ---------------------------
class Square{
 int xPosition, yPosition;

 Square(int xPos, int yPos){
 xPosition = xPos;
 yPosition = yPos;
 }

 int getX(){
 return xPosition;
 }

 int getY(){
 return yPosition;
 }

 void setY(int yPos){
 yPosition = yPos;
 }
}

blow it says

WARNING: RXTX Version mismatch
Jar version = RXTX-2.2pre1
native lib Version = RXTX-2.2pre2

I'm not sure where I'm going wrong please help

thank you

Processing Code to Display Amped Visualizer

$
0
0

Hello guys, I need a helping hand here. I am new to this processing software and i obtained a processing code along with my brand new Pulse Sensor. I successfully call out the visualizer ( printed screen below ), but there was no reading on the graph, it just drop to zero although my pulse sensor is working perfectly with Arduino Uno. Please help me....thanks anyway

Visualizer

Here is my code:

/**
THIS PROGRAM WORKS WITH PulseSensorAmped_Arduino-xx ARDUINO CODE
THE PULSE DATA WINDOW IS SCALEABLE WITH SCROLLBAR AT BOTTOM OF SCREEN
PRESS 'S' OR 's' KEY TO SAVE A PICTURE OF THE SCREEN IN SKETCH FOLDER (.jpg)
MADE BY JOEL MURPHY AUGUST, 2012
*/


import processing.serial.*;
PFont font;
Scrollbar scaleBar;

Serial port;

int Sensor;      // HOLDS PULSE SENSOR DATA FROM ARDUINO
int IBI;         // HOLDS TIME BETWEN HEARTBEATS FROM ARDUINO
int BPM;         // HOLDS HEART RATE VALUE FROM ARDUINO
int[] RawY;      // HOLDS HEARTBEAT WAVEFORM DATA BEFORE SCALING
int[] ScaledY;   // USED TO POSITION SCALED HEARTBEAT WAVEFORM
int[] rate;      // USED TO POSITION BPM DATA WAVEFORM
float zoom;      // USED WHEN SCALING PULSE WAVEFORM TO PULSE WINDOW
float offset;    // USED WHEN SCALING PULSE WAVEFORM TO PULSE WINDOW
color eggshell = color(255, 253, 248);
int heart = 0;   // This variable times the heart image 'pulse' on screen
//  THESE VARIABLES DETERMINE THE SIZE OF THE DATA WINDOWS
int PulseWindowWidth = 490;
int PulseWindowHeight = 512;
int BPMWindowWidth = 180;
int BPMWindowHeight = 340;
boolean beat = false;    // set when a heart beat is detected, then cleared when the BPM graph is advanced


void setup() {
  size(700, 600);  // Stage size
  frameRate(100);
  font = loadFont("Arial-BoldMT-24.vlw");
  textFont(font);
  textAlign(CENTER);
  rectMode(CENTER);
  ellipseMode(CENTER);
// Scrollbar constructor inputs: x,y,width,height,minVal,maxVal
  scaleBar = new Scrollbar (400, 575, 180, 12, 0.5, 1.0);  // set parameters for the scale bar
  RawY = new int[PulseWindowWidth];          // initialize raw pulse waveform array
  ScaledY = new int[PulseWindowWidth];       // initialize scaled pulse waveform array
  rate = new int [BPMWindowWidth];           // initialize BPM waveform array
  zoom = 0.75;                               // initialize scale of heartbeat window

// set the visualizer lines to 0
 for (int i=0; i<rate.length; i++){
    rate[i] = 555;      // Place BPM graph line at bottom of BPM Window
   }
 for (int i=0; i<RawY.length; i++){
    RawY[i] = height/2; // initialize the pulse window data line to V/2
 }

// GO FIND THE ARDUINO
  println(Serial.list());    // print a list of available serial ports
  // choose the number between the [] that is connected to the Arduino
  port = new Serial(this, Serial.list()[0], 115200);  // make sure Arduino is talking serial at this baud rate
  port.clear();            // flush buffer
  port.bufferUntil('\n');  // set buffer full flag on receipt of carriage return
}

void draw() {
  background(0);
  noStroke();
// DRAW OUT THE PULSE WINDOW AND BPM WINDOW RECTANGLES
  fill(eggshell);  // color for the window background
  rect(255,height/2,PulseWindowWidth,PulseWindowHeight);
  rect(600,385,BPMWindowWidth,BPMWindowHeight);

// DRAW THE PULSE WAVEFORM
  // prepare pulse data points
  RawY[RawY.length-1] = (1023 - Sensor) - 212;   // place the new raw datapoint at the end of the array
  zoom = scaleBar.getPos();                      // get current waveform scale value
  offset = map(zoom,0.5,1,150,0);                // calculate the offset needed at this scale
  for (int i = 0; i < RawY.length-1; i++) {      // move the pulse waveform by
    RawY[i] = RawY[i+1];                         // shifting all raw datapoints one pixel left
    float dummy = RawY[i] * zoom + offset;       // adjust the raw data to the selected scale
    ScaledY[i] = constrain(int(dummy),44,556);   // transfer the raw data array to the scaled array
  }
  stroke(250,0,0);                               // red is a good color for the pulse waveform
  noFill();
  beginShape();                                  // using beginShape() renders fast
  for (int x = 1; x < ScaledY.length-1; x++) {
    vertex(x+10, ScaledY[x]);                    //draw a line connecting the data points
  }
  endShape();

// DRAW THE BPM WAVE FORM
// first, shift the BPM waveform over to fit then next data point only when a beat is found
 if (beat == true){   // move the heart rate line over one pixel every time the heart beats
   beat = false;      // clear beat flag (beat flag waset in serialEvent tab)
   for (int i=0; i<rate.length-1; i++){
     rate[i] = rate[i+1];                  // shift the bpm Y coordinates over one pixel to the left
   }
// then limit and scale the BPM value
   BPM = min(BPM,200);                     // limit the highest BPM value to 200
   float dummy = map(BPM,0,200,555,215);   // map it to the heart rate window Y
   rate[rate.length-1] = int(dummy);       // set the rightmost pixel to the new data point value
 }
 // GRAPH THE HEART RATE WAVEFORM
 stroke(250,0,0);                          // color of heart rate graph
 strokeWeight(2);                          // thicker line is easier to read
 noFill();
 beginShape();
 for (int i=0; i < rate.length-1; i++){    // variable 'i' will take the place of pixel x position
   vertex(i+510, rate[i]);                 // display history of heart rate datapoints
 }
 endShape();

// DRAW THE HEART AND MAYBE MAKE IT BEAT
  fill(250,0,0);
  stroke(250,0,0);
  // the 'heart' variable is set in serialEvent when arduino sees a beat happen
  heart--;                    // heart is used to time how long the heart graphic swells when your heart beats
  heart = max(heart,0);       // don't let the heart variable go into negative numbers
  if (heart > 0){             // if a beat happened recently,
    strokeWeight(8);          // make the heart big
  }
  smooth();   // draw the heart with two bezier curves
  bezier(width-100,50, width-20,-20, width,140, width-100,150);
  bezier(width-100,50, width-190,-20, width-200,140, width-100,150);
  strokeWeight(1);          // reset the strokeWeight for next time


// PRINT THE DATA AND VARIABLE VALUES
  fill(eggshell);                                       // get ready to print text
  text("Pulse Sensor Amped Visualizer 1.1",245,30);     // tell them what you are
  text("IBI " + IBI + "mS",600,585);                    // print the time between heartbeats in mS
  text(BPM + " BPM",600,200);                           // print the Beats Per Minute
  text("Pulse Window Scale " + nf(zoom,1,2), 150, 585); // show the current scale of Pulse Window

//  DO THE SCROLLBAR THINGS
  scaleBar.update (mouseX, mouseY);
  scaleBar.display();

//
}  //end of draw loop


//.............................................scalebar (name of file)............................................................................................................


/**
    THIS SCROLLBAR OBJECT IS BASED ON THE ONE FROM THE BOOK "Processing" by Reas and Fry
*/

class Scrollbar{
 int x,y;               // the x and y coordinates
 float sw, sh;          // width and height of scrollbar
 float pos;             // position of thumb
 float posMin, posMax;  // max and min values of thumb
 boolean rollover;      // true when the mouse is over
 boolean locked;        // true when it's the active scrollbar
 float minVal, maxVal;  // min and max values for the thumb

 Scrollbar (int xp, int yp, int w, int h, float miv, float mav){ // values passed from the constructor
  x = xp;
  y = yp;
  sw = w;
  sh = h;
  minVal = miv;
  maxVal = mav;
  pos = x - sh/2;
  posMin = x-sw/2;
  posMax = x + sw/2;  // - sh;
 }

 // updates the 'over' boolean and position of thumb
 void update(int mx, int my) {
   if (over(mx, my) == true){
     rollover = true;            // when the mouse is over the scrollbar, rollover is true
   } else {
     rollover = false;
   }
   if (locked == true){
    pos = constrain (mx, posMin, posMax);
   }
 }

 // locks the thumb so the mouse can move off and still update
 void press(int mx, int my){
   if (rollover == true){
    locked = true;            // when rollover is true, pressing the mouse button will lock the scrollbar on
   }else{
    locked = false;
   }
 }

 // resets the scrollbar to neutral
 void release(){
  locked = false;
 }

 // returns true if the cursor is over the scrollbar
 boolean over(int mx, int my){
  if ((mx > x-sw/2) && (mx < x+sw/2) && (my > y-sh/2) && (my < y+sh/2)){
   return true;
  }else{
   return false;
  }
 }

 // draws the scrollbar on the screen
 void display (){

  noStroke();
  fill(255);
  rect(x, y, sw, sh);      // create the scrollbar
  fill (250,0,0);
  if ((rollover == true) || (locked == true)){
   stroke(250,0,0);
   strokeWeight(8);           // make the scale dot bigger if you're on it
  }
  ellipse(pos, y, sh, sh);     // create the scaling dot
  strokeWeight(1);            // reset strokeWeight
 }

 // returns the current value of the thumb
 float getPos() {
  float scalar = sw / sw;  // (sw - sh/2);
  float ratio = (pos-(x-sw/2)) * scalar;
  float p = minVal + (ratio/sw * (maxVal - minVal));
  return p;
 }
 }

//...........................................serialevent (name of file)..........................................................................................................



void serialEvent(Serial port){
   String inData = port.readStringUntil('\n');
   inData = trim(inData);                 // cut off white space (carriage return)

   if (inData.charAt(0) == 'S'){          // leading 'S' for sensor data
     inData = inData.substring(1);        // cut off the leading 'S'
     Sensor = int(inData);                // convert the string to usable int
   }
   if (inData.charAt(0) == 'B'){          // leading 'B' for BPM data
     inData = inData.substring(1);        // cut off the leading 'B'
     BPM = int(inData);                   // convert the string to usable int
     beat = true;                         // set beat flag to advance heart rate graph
     heart = 20;                          // begin heart image 'swell' timer
   }
 if (inData.charAt(0) == 'Q'){            // leading 'Q' means IBI data
     inData = inData.substring(1);        // cut off the leading 'Q'
     IBI = int(inData);                   // convert the string to usable int
   }
}

Processing + Arduino + Flexiforce

$
0
0

Hi there,

I'm trying to import readings from a Flexiforce sensor however, the values in processing are different than the ones displayed in the Arduino serial monitor but they somehow respond to any force applied on the sensor.

Could anyone clarify what's going on?

Thanks in advance :)

Arduino Code:

void setup()
{
  // Start serial at 9600 baud
  Serial.begin(9600);
}

void loop()
{
  // Read the input on analog pin 0:
  int sensorValue = analogRead(A0);

  //Serial.println(sensorValue);
  Serial.write(sensorValue);

  // Wait 100 milliseconds
  delay(100);
}

Serial Monitor Value (150gr):

    330
    330
    330
    330
    330
    330
    331
    330
    330
    330
    330
    329
    330
    330
    330
    330
    330
    330
    330
    331

Processing Code:

import processing.serial.*;

Serial port;                             // Create object from Serial class
int val = 0;

void setup() {
  size(200, 200);
  frameRate(10);
  // Open the port that the board is connected to and use the same speed (9600 bps)
  printArray(Serial.list());
  port = new Serial(this, Serial.list()[3], 9600);
}

void draw() {

  if (0 < port.available()) {         // If data is available,
    val = port.read();     // read it and store it in val
  }

  background(255);                       // Set background to white
  println(val);
  float dia = map(val, 0, 300, height*0.1, height*0.9);
  fill(0);
  ellipse(width*0.5, height*0.5, dia, dia);
}

Processing Println Values (150gr):

    88
    88
    87
    88
    88
    88
    88
    89
    88
    88
    88
    88
    88
    88
    87

im trying to map the screen size of a video, what am i missing?

$
0
0
int x = 0;
int y = 0;
int valx;
int valy;

void setup() {
  size(200, 200);
  background(0);

}

void draw() {
valx = map(x, 0, 195, 0, 80);
valy = map(y, 0, 195, 0, 80);

  println("X" + " ", mouseX, "                          Y" + " ", mouseY);
}

i even try this and nothing

valx = map(x, mouseX, mouseX, 0, 80);
valy = map(y, mouseY, mouseY, 0, 80);

my code is running very slowly, why and how do i fix it?

$
0
0

so im working on a code for a 2 player pong via arduino, the arduino just sands values from the pontciometer and most of the load is on processing, i started to lay down code that is still not in use, so if you see unused voids/ booleans thats why,sowhy is it running so slow, and bearly updates? processing code:

`import processing.serial.*; Serial ard; int info1 = 200; int data = 0; int y=0; int info2; void setup() { fullScreen(); ard = new Serial(this, Serial.list()[0], 9600); set(); }

void draw() {

set(); if (ard.available()>0) { data = ard.read(); } println(data); pong1(data); delay(10); } void pong1(int i) { fill(0, 100, 0); constrain(i, 0, 100); rect((width/100)90, (height/100)i, (width/100)3, (height/100)20); } void pong2(int i) { } boolean pong1h(int i, int y) { //y needs to be 0-100,i needs to be 0-100 if (y > i && y < i+20) { return(true); } else { return(false); } }

boolean pong2h(int i) { return(true); }

void set() { background(0); noStroke(); fill(120); rect((width/100)5, (height/100)5, (width/100)5, (height/100)95); rect((width/100)5, (height/100)5, (width/100)95, (height/100)5 ); rect((width/100)95, (height/100)5, (width/100)5, (height/100)95 ); rect((width/100)5, (height/100)97, (width/100)95, (height/100)5 ); for (int i=0; i < 5; i++) { rect((width/100)50, (height/6)i+80, (width/100)5, (height/100)10); } }`

arduino code: ( there is unused lines that i // so that i could check stuff) `int pot1; int pot2; void setup() { Serial.begin(9600); }

void loop() { pot1 = analogRead(A0); // pot2 = analogRead(A1); //pot2 = 1000; //Serial.print('A'); Serial.write(map(pot1,0,1024,0,100)); // Serial.print('B'); // Serial.print(map(pot2,0,1024,0,100)); delay(1); }`

How to develop a star trecking system for my telescope?

$
0
0

Hi, i’m Alex and I come from Germany. well, my hobby is astronomy and I will develop an automaticly star tracking system.

Which parts do I have now: 1x Arduino UNO 2x Stepper motor 1x Webcam 1x Telescope 1x Laptop

My first setep with processing was 4 weeks ago. Currently, I can conect the arduino with processing and processing visualized the value from arduino. I can also conect a webcam with processing.

The next step will be: How to realize a start trackin system?

My ideas are: The Webcam view in the sky, I pick out the brightest star from the display which is suitable for tracking and the Arduino will controll the stepper motor for X and Y axis from the telescope . I have never done this bevore, so... I hope you can help/support me ☺ . I apologize for my bad english and I hope you understand me. How to start best?

Best regards from Germany ☺


Problem with serial communication

$
0
0

I have written this in the German Arduino forum. http://forum.arduino.cc/index.php?topic=189259.0 ( Last section ).

i dont want to open a new thread, because here are the best serial-speicalist, i guess. Afterwards the communication between between Arduino and my Java-Console is working very fine. The Communication between my Arduino and my Java-Console (Cockpit) is working fine, thank you! The next Step is about the activation of the Bluetooth-connection. My Cockpit is equipped with controlP5 - elements. I am using a BT 1.05, which is recognized as HC6. The device manager is showing a COM7 and 8 port.

I used this connection for debbuging my code, which was a great help! What i am wondering about is, i am trying to describe the situation as good as i can. The BT - module is connected with the Arduino and is blinking so far. If i run the Putty with the right parameters (for example: COM7, 11522 baudrate), the BTlight is burning all the time and the arduino values are visible. The Arduino is running on a external 12V. My Java-Console recognized the COM5, COM7 and 8.

COM5 is the connection. The COM5 connection is terminated after the flash. If i put off the Putty, the console is showing only COM 5 and 8. Therefore a communication between Arduino and Cockpit is impossible. What might that be?

LG Willi

G4P Library Processing with Arduino, ISIS Proteus and VSPE

$
0
0

Hi,

I'm using G4P Library and I want to add Arduino code in my sketch but I can't. I'm using VSPE and Proteus for the Arduino UNO.

Here it's my Processing code (with G4P) :

import g4p_controls.*;
import processing.serial.*;
Serial monPort;
int mesure;
PImage background;
PImage background2;
PImage logocondorcet;
int d = day();    // Variable jour
int m = month();  // Variable mois
int y = year();   // Variable année
//Initialisation des variables
 int temperature; //Temperature mesurée par l'Arduino
 int j;           //Indice de travail
 int k;           //Indice de travail

public void setup(){
  size(800, 500, JAVA2D);
  createGUI();
  customGUI();
  background = loadImage("background.png"); // background
  logocondorcet = loadImage("logocondo.png"); // logo condorcet
  background2 = loadImage("background2.png"); // background2
  textFont(loadFont("Roboto-Light-20.vlw")); // police de caractère
  println(Serial.list());    // Affichage dans la console de la liste des ports serie du PC
 // monPort = new Serial(this, "COM2", 9600);   //Initialisation de la communicaiton port serie
  //monPort.bufferUntil('\n'); //Attend la réception d'un fin de ligne pour générer un serialEvent()
}


public void draw(){
  background(background);
  image(logocondorcet, 5,10);
  String s = String.valueOf(d); // jour
  text(s, 632, 77);
  text("/", 644,77);
  s = String.valueOf(m); // mois
  text(s, 652, 77);
  text("/", 665,77);
  s = String.valueOf(y); // année
  text(s, 673, 77);
  text(+hour()+ ":"+minute()+":"+second(), 720, 77);
}

synchronized public void win_draw1(PApplet appc, GWinData data) { //_CODE_:window1:473254:
  appc.background(background2);
  appc.textFont(loadFont("Roboto-Light-20.vlw")); // police de caractère
  appc.fill(250);
  String s = String.valueOf(d); // jour
  appc.text(s, 632, 77);
  appc.text("/", 644,77);
  s = String.valueOf(m); // mois
  appc.text(s, 652, 77);
  appc.text("/", 665,77);
  s = String.valueOf(y); // année
  appc.text(s, 673, 77);
  appc.text(+hour()+ ":"+minute()+":"+second(), 720, 77);
  // température
  appc.fill(250);
  appc.stroke(0);
  appc.strokeWeight(1);
  //appc.rect (90,20,180,500); // Thermometre
  appc.fill(255,0,0);
  appc.fill(0,0,255);
  appc.fill(50);
  appc.noStroke();
  appc.rect(210,10,20,360); // rectangle barre
  appc.ellipse(220, 360, 40, 40); // ellipse barre
  // dessin du réservoir
  appc.ellipse(220, 360, 40, 40);
  appc.fill(#FF1008); // ROUGE
  appc.ellipse(220, 360, 40, 40);
  //Gradations et textes tous les 10 degrés
 fill(50);
 strokeWeight(2);
 stroke(50);

} //_CODE_:window1:473254:

synchronized public void win_draw2(PApplet appc, GWinData data) { //_CODE_:window2:601170:
  appc.background(background2);
  appc.textFont(loadFont("Roboto-Light-20.vlw")); // police de caractère
  appc.fill(250);
  String s = String.valueOf(d); // jour
  appc.text(s, 632, 77);
  appc.text("/", 644,77);
  s = String.valueOf(m); // mois
  appc.text(s, 652, 77);
  appc.text("/", 665,77);
  s = String.valueOf(y); // année
  appc.text(s, 673, 77);
  appc.text(+hour()+ ":"+minute()+":"+second(), 720, 77);
} //_CODE_:window2:601170:

synchronized public void win_draw3(PApplet appc, GWinData data) { //
  appc.background(background2);
  appc.textFont(loadFont("Roboto-Light-20.vlw")); // police de caractère
  appc.fill(250);
  String s = String.valueOf(d); // jour
  appc.text(s, 632, 77);
  appc.text("/", 644,77);
  s = String.valueOf(m); // mois
  appc.text(s, 652, 77);
  appc.text("/", 665,77);
  s = String.valueOf(y); // année
  appc.text(s, 673, 77);
  appc.text(+hour()+ ":"+minute()+":"+second(), 720, 77);
} //_CODE_:window2:601170:

void createWindows() // temperature et humidité
{
  window1 = GWindow.getWindow(this, "Window title", 0, 0, 800, 500, JAVA2D);
  window1.setActionOnClose(G4P.CLOSE_WINDOW);
  window1.addDrawHandler(this, "win_draw1");
  imgButton8 = new GImageButton(window1, 521, 7, new String[] { "User.png", "User.png", "User.png" } );
  imgButton8.addEventHandler(this, "imgButton8_click1");
  imgButton9 = new GImageButton(window1, 685, 463, new String[] { "quitter.png", "quitter.png", "quitter.png" } );
  imgButton9.addEventHandler(this, "imgButton9_click1");
  imgButton10 = new GImageButton(window1, 354, 409, new String[] { "humid.png", "humid.png", "humid.png" } );
  imgButton10.addEventHandler(this, "imgButton10_click1");
  imgButton11 = new GImageButton(window1, 74, 410, new String[] { "temp.png", "temp.png", "temp.png" } );
  imgButton11.addEventHandler(this, "imgButton11_click1");
  imgButton12 = new GImageButton(window1, 405, 177, new String[] { "humid2.png", "humid2.png", "humid2.png" } );
  imgButton12.addEventHandler(this, "imgButton12_click1");
}

void createWindows2() // comptage
{
  window2 = GWindow.getWindow(this, "Comptage", 521, 7, 800, 500, JAVA2D);
  window2.setActionOnClose(G4P.CLOSE_WINDOW);
  window2.addDrawHandler(this, "win_draw2");
  imgButton13 = new GImageButton(window2, 253, 110, new String[] { "Comptage2.png", "Comptage2.png", "Comptage2.png" } );
  imgButton13.addEventHandler(this, "imgButton13_click1");
  imgButton14 = new GImageButton(window2, 521, 7, new String[] { "User.png", "User.png", "User.png" } );
  imgButton14.addEventHandler(this, "imgButton14_click1");
  imgButton18 = new GImageButton(window2, 685, 463, new String[] { "quitteeeer.png", "quitteeeer.png", "quitteeeer.png" } );
  imgButton18.addEventHandler(this, "imgButton18_click1");
}

void createWindows3() // masse
{
  window3 = GWindow.getWindow(this, "Window title", 0, 0, 800, 500, JAVA2D);
  window3.setActionOnClose(G4P.CLOSE_WINDOW);
  window3.addDrawHandler(this, "win_draw3");
  imgButton15 = new GImageButton(window3, 521, 7, new String[] { "User.png", "User.png", "User.png" } );
  imgButton15.addEventHandler(this, "imgButton15_click1");
  imgButton16 = new GImageButton(window3, 257, 409, new String[] { "boutonkg.png", "boutonkg.png", "boutonkg.png" } );
  imgButton16.addEventHandler(this, "imgButton16_click1");
  imgButton17 = new GImageButton(window3, 259, 118, new String[] { "kgmass.png", "kgmass.png", "kgmass.png" } );
  imgButton17.addEventHandler(this, "imgButton17_click1");
  imgButton19 = new GImageButton(window3, 685, 463, new String[] { "quitteeeer.png", "quitteeeer.png", "quitteeeer.png" } );
  imgButton19.addEventHandler(this, "imgButton19_click1");
}

// Use this method to add additional statements
// to customise the GUI controls
public void customGUI(){
}

and I want to add that to the win_draw1 :

 // Librairie communication serie
 import processing.serial.*;

 // Initialisation des variables
 Serial monPort;  // Déclatation port série pour la lecture des données envoyées par Arduino
 int mesure;      // Mesure lue sur le port

//Initialisation des variables
 int temperature; //Temperature mesurée par l'Arduino
 int j;           //Indice de travail
 int k;           //Indice de travail

//Traitements d'initialisation
void setup() {

 //Initialisations port série
 println(Serial.list());    // Affichage dans la console de la liste des ports serie du PC
 monPort = new Serial(this, "COM2", 9600);   //Initialisation de la communicaiton port serie
 monPort.bufferUntil('\n'); //Attend la réception d'un fin de ligne pour générer un serialEvent()

 //Initialisatiopns graphiques
 size (240,540);
 background(#9FB84D); // VERT CLAIR
 smooth();  //On active le lissage

 //Dessin des cadres -------------------------
 stroke(0);
 strokeWeight(1);
 fill(230);
 rect (20,20,180,500); //Thermometre


 //Dessin des titres  -------------------------
 fill(255,0,0);

 text("Thermomètre Station Météo",30, 40);
 fill(0,0,255);


 //Dessin du thermomètre -----------------------
 fill(50);
 noStroke();
 rect(100,70,20,420);
 ellipse(110, 490, 40, 40);

 //Dessin du réservoir
 ellipse(110, 70, 20, 20);
 fill(#FF1008); // ROUGE
 ellipse(110, 490, 30, 30);

 //Gradations et textes tous les 10 degrés
 fill(50);
 strokeWeight(2);
 stroke(50);

 //à gauche
 for (int i = 0; i < 11; i++) {
      j=i*40;
      k=i*10-50;
      line(90, 475-j, 100,475-j);
      text(k+" °C", 50, 475-j);
  }


 //Gradations fines des degrés

 //à gauche
 strokeWeight(1);
 stroke(50);
 for (int i = 0; i < 50; i++) {
         j=i*8;
         line(95, 475-j, 100,475-j);
 }

 //à droite
 strokeWeight(1);
 stroke(50);
}

}

//Traitements itératifs
 void draw() {
        // Pas de traitement car tout est réalisé dans la fonction serialEvent()
   }

//Traitements à réception d'une fin de ligne
 void serialEvent (Serial monPort)
  {
    //Récupération sur le port série de la tension sous forme de chaine de caractères
      String tensionCar = monPort.readStringUntil('\n');
      if (tensionCar != null)
        {
          tensionCar = trim(tensionCar); // Suppression des blancs au début et à la fin de la chaine de caractère
          int tensionNum = int(tensionCar);  // Conversion de la tension codée en CHAR en valeur décimale puis calcul température
          float temperature = ((500 * tensionNum) / (3.3 * 1024)) - 50.0;

      //Affichage des températures ----------------

      //Dessin des cadres -------------------------
      stroke(0);
      strokeWeight(1);

      //Dessin du thermomètre -----------------------
      fill(50);
      noStroke();
      rect(100,70,20,420);
      ellipse(110, 490, 40, 40);

      // Dessin du réservoir
      ellipse(110, 70, 20, 20);
      fill(#FF1008); // ROUGE VIF
      ellipse(110, 490, 30, 30);

      //Dessin temperature actuelle -----------------------
      noStroke();
      fill(#FF1008); // ROUGE VIF
      rect(105,476-(50+temperature)*4,10,(50+temperature)*4);
      fill(#F59300); // ORANGE
      rect(110,476-(50+temperature)*4,3,(50+temperature)*4);

  }
 }

Here it's the Arduino code :

    int temperature;

    void setup()
      {
        Serial.begin(9600);
      }

    void loop()
      {

        temperature = analogRead(A1);
        Serial.println(temperature);
        delay(1000);
      }

Can you help me to add this code to the win_draw1 ? It's for the temperature. I'm sorry for the french code, if you can help me with Skype (in live) it's cool.

Regards, Itachi

Wireless and Processing

$
0
0

Friends:

I have been working on a prototype device for some time with success but now have a question regarding incorporating wireless.

The basic set up is that video input is assessed using Processing. If certain criteria are met, Processing sends a byte to the computer serial port, that byte is read by Arduino, and depending on the byte (a character from 0-12) a particular pin (#2-13) is set to high. That activates one of 12 corresponding motors. I am expanding the set-up using a Mega Arduino such that 36-49 output pins on the Arduino are each connected to 36-49 individual motors.

Now, I want to go wireless between the computer and the Arduino, and I need advice on how best to do that; there seems to be an issue with my current approach. In preliminary tests using an off-brand APC220 USB transmitter and a receiver plugged into an Uno. I can communicate wirelessly directly from the computer (by typing into the serial com window) to the Arduino. However, Processing does not communicate with the Arduino through the serial port when the transmitter is plugged in; It says the port is busy. So, I am looking for a wireless solution (perhaps a shield) and a protocol that will work with Processing.

A specific suggestion (as to hardware or tutorial pages) would be helpful.

Thanks in

Dr. P.

How to processing to work with arduino on mac?

$
0
0

Hi there,

I am a beginner and I am currently working on an arduino projects that requries some coding on processing. Supposingly when I type in my code in both arduino and processing like this, I would be able to change the color of the picture using the potentiometer on arduino.

However, when I compiled successfully and down the program to my arduino uno, it just wont work! I've check my circuit and code and they have no problem. I observed that all of the PCs in our class had no prblem of getting it to work. I am curious that if it has some thing differently to do with Mac?屏幕快照 2016-02-24 下午2.29.10

How to processing to work with arduino on mac?

$
0
0

Hi there,

I am a beginner and I am currently working on an arduino projects that requries some coding on processing. Supposingly when I type in my code in both arduino and processing like this, I would be able to change the color of the picture using the potentiometer on arduino.

However, when I compiled successfully and down the program to my arduino uno, it just wont work! I've check my circuit and code and they have no problem. I observed that all of the PCs in our class had no prblem of getting it to work. I am curious that if it has some thing differently to do with Mac? 屏幕快照 2016-02-24 下午2.29.10

Viewing all 747 articles
Browse latest View live