I am searching for Processing software that can interface with arduino . Main agenda is to collect data from Serial and analog port and also need to control digitals ios high or low.
Is any software avilable Where i can control My Arduino IOS , see the Serial output data, Read analog value .
In below code my pin connected to analog pin 5. I wanted to show on display screen only output current value. How can i show it???
I have digital Pins say s 5 . through software i wanted to control pin high or Low, so led start glowing. is any software readily avilable???
If available let me know.
I need to collect data serially from arduino display on processing. If i say digital pin high in sogtware it must activate the relay or bulb which connected to arduino board @ interface. It should keep reading analog converted values coming serially trhrough program as mentioned above.
I have only 2 perameter
control the relays
to read sensor values.
If you have any example code or software share links. I am having visual studio software.
With Realterm you just see the value's. You can select it to display HEX, ASCII or even binary but you do need to convert it yourself.
To send data you send either a ASCII value or HEX value.
With Visual Studio (In my case C#) you can make a nice GUI (Graphic User Interface). Have the analog value presented just the way you want it to (With coding the C#) and make a nice button, that when you press it sends the already formatted data (Again, by coding it in the C#).
I don't have any real examples right now. I could make one really fast tonight when i'm off work...
(BTW, this topic actually belongs in the "interfacing w/ software on computer" group...)
@c-f-k
Yes i wanted to read value as it converted. Here is my actual code. If rellay got tripped some red bulb shold triggered else green bulb to be triggered. If any fault manually operated by selecting switch. This code not complete. Indivually working fine.
But if there fault light should be red on processing else it should go green, Some digital pin to control these pins
#include <MsTimer2.h>
#define RELAY1 7
#define RELAY2 6
#define MAX_TRIP_COUNT 5
float Current_Limit=0.60;
int newaverage;
float Output_Current;
static int Trip_Count=0;
static int Tripped_Flag=1;
int led = 13;
#include <avr/wdt.h>
void TakeReading()
{
newaverage = analogRead(A5);
Serial.print("count:");
Serial.println(newaverage);
Output_Current = 0.0336666666667*newaverage - 17.17;
}
void Relay_Activate()
{
for (unsigned long start = millis(); millis() - start < 10000;)
{
digitalWrite(RELAY1,HIGH);
digitalWrite(RELAY2,HIGH);
Serial.println("RELAY GOT TRIPPED");
Tripped_Flag=0;
Trip_Count=0;
}
}
void Relay_Deactivate()
{
digitalWrite(RELAY1,LOW);
digitalWrite(RELAY2,LOW);
Serial.println("RELAY NOT TRIPPED");
Tripped_Flag=1;
}
void Relay_Intialize()
{
Serial.println("RELAY GOT INTIALISE....");
digitalWrite(RELAY1,LOW);
digitalWrite(RELAY2,LOW);
}
void setup()
{
Serial.begin(9600);
pinMode(led, OUTPUT);
pinMode(RELAY1,INPUT);
wdt_enable(WDTO_8S);
Relay_Intialize();
}
void loop()
{
// MsTimer2::set(1000, TakeReading); // 500ms period
// MsTimer2::start();
wdt_reset();
TakeReading();
Serial.print("Output_Current:");
Serial.println(Output_Current);
if(Output_Current>Current_Limit)
{
Trip_Count=Trip_Count+1;
Serial.print("Trip_Count:");
Serial.println(Trip_Count);
if(Trip_Count>=5)
{
Relay_Activate();
}
}else
{
if(Trip_Count<=0)
{
Trip_Count=0;
}else
{
Trip_Count=Trip_Count-1;
}
Relay_Deactivate();
Serial.print("Trip_Count:");
Serial.println(Trip_Count);
}
Serial.println(".......................");
/* digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000);
*/
delay(2000);
}
I wanted to know How to get data from analog port and display converted value on Monitor via processing.
On what Monitor? If you are referring to the Serial Monitor, it can NOT be done. Either Processing can talk to the Arduino OR the Serial Monitor application can.
I want to controll digital IO. IF click it pin should be high, Else it should be low.
Here my processing code. I just want to enable 13 pin. If enable blink 13 pin high else low make led off.
import processing.serial.*;
import cc.arduino.*;
Arduino arduino;
color off = color(4, 79, 111);
color on = color(84, 145, 158);
int[] values = { Arduino.LOW, Arduino.LOW, Arduino.LOW, Arduino.LOW,
Arduino.LOW, Arduino.LOW, Arduino.LOW, Arduino.LOW, Arduino.LOW,
Arduino.LOW, Arduino.LOW, Arduino.LOW, Arduino.LOW, Arduino.LOW };
void setup() {
size(470, 200);
// Prints out the available serial ports.
println(Arduino.list());
// Modify this line, by changing the "0" to the index of the serial
// port corresponding to your Arduino board (as it appears in the list
// printed by the line above).
arduino = new Arduino(this, Arduino.list()[0], 9600);
// Alternatively, use the name of the serial port corresponding to your
// Arduino (in double-quotes), as in the following line.
//arduino = new Arduino(this, "/dev/tty.usbmodem621", 57600);
// Set the Arduino digital pins as outputs.
for (int i = 0; i <= 13; i++)
arduino.pinMode(i, Arduino.OUTPUT);
}
void draw() {
background(off);
stroke(on);
for (int i = 0; i <= 13; i++) {
if (values[i] == Arduino.HIGH)
fill(on);
else
fill(off);
rect(420 - i * 30, 30, 20, 20);
}
}
void mousePressed()
{
int pin = (450 - mouseX) / 30;
// Toggle the pin corresponding to the clicked square.
if (values[pin] == Arduino.LOW) {
arduino.digitalWrite(pin, Arduino.HIGH);
values[pin] = Arduino.HIGH;
} else {
arduino.digitalWrite(pin, Arduino.LOW);
values[pin] = Arduino.LOW;
}
}
Arduino code
int led1=13;
int IN=2;
void setup()
{
Serial.begin(9600);
pinMode(led1, OUTPUT);
pinMode(IN, INPUT);
}
void loop()
{
if(Serial.available()>0)
{
if (digitalRead(IN)==1)
{
digitalWrite(led1,HIGH);
}else
{
digitalWrite(led1,LOW);
}
}
}
I am thinkling like this way. If i make customised tag say as shown in above example if click any button it should make changes via PC. Control input are given from PC for digital IOS of arduino. IF highlighted make digital pin high else if pressed again not highlighted make it low