i need help

I write a program in arduino by using processing that control devices by clicking. However the program works fine by using the mouse of computer or labtop. but if I control the clicking by using camera mouse 2015 the program not responding ( I mean the program that not responding to click to control the devices). Therefore I would like to ask your help in my problems thanks hasan alsaeed hasan.n.alseed@ieee.org

hasan_alsaeed: I write a program in arduino by using processing that control devices by clicking. However the program works fine by using the mouse of computer or labtop. but if I control the clicking by using camera mouse 2015 the program not responding ( I mean the program that not responding to click to control the devices). Therefore I would like to ask your help in my problems thanks hasan alsaeed hasan.n.alseed@ieee.org

Probably an issue with either the hardware you're not telling us about or the code you're not telling us about.

If you really want help, don't you think some details are in order? None of us can see your project.

Welcome to the Forum. Please read the two posts by Nick Gammon on the proper way to post on this Forum, especially when posting code, be sure to format it before posting (use Ctrl-T in the IDE) and then use code tags when adding the code to your post. It will help us help you.

Delta_G:
Probably an issue with either the hardware you’re not telling us about or the code you’re not telling us about.

If you really want help, don’t you think some details are in order? None of us can see your project.

THIS MY CODE
import processing.serial.*;
Serial port;
PFont f1, f2;
PImage i1, i2, i3, i4;
char FAN_state, LIGHT_state, TV_state, ALARM_state;
void setup() {
size(840, 510);
port = new Serial(this, “COM1”, 9600);
frameRate(10);
f1 = loadFont(“Gabriola-62.vlw”);
f2 = loadFont(“Georgia-32.vlw”);
i1 = loadImage(“FAN.png”);
i2 = loadImage(“LIGHT.png”);
i3 = loadImage(“TV.png”);
i4 = loadImage(“ALARM.jpg”);
FAN_state = 0;
LIGHT_state = 0;
TV_state = 0;
ALARM_state = 0;
}

void draw() {
background(255, 248, 220);
//Title
fill(205, 103, 23);
textFont(f1);
text(“HOME AUTOMATION”, 210, 50);

//Boxes
fill(255);
stroke(0);
strokeWeight(3);
int rectW = 180;
int rectH = 250;
rect(30, 100, rectW, rectH);
rect(230, 100, rectW, rectH);
rect(430, 100, rectW, rectH);
rect(630, 100, rectW, rectH);

//Images
image(i1, 35, 105, 170, 240);
image(i2, 235, 105, 170, 240);
image(i3, 435, 105, 170, 240);
image(i4, 635, 105, 170, 240);

//Box Title
fill(205, 103, 23);
textFont(f2);
text(“FAN”, 85, 400);
text(“LIGHT”, 270, 400);
text(“TV”, 500, 400);
text(“ALARM”, 665, 400);

//Update States
if(mousePressed && (overCircle(55,450,50)||overPicture(30, 100, rectW, rectH))){
FAN_state ^= 1;
port.write(‘T’);
//port.write(FAN_state);
delay(500);
}
if(mousePressed && (overCircle(255,450,50)||overPicture(230, 100, rectW, rectH))){
LIGHT_state ^= 1;
port.write(‘A’);
//port.write(LIGHT_state);
delay(500);
}
if(mousePressed && (overCircle(455,450,50)||overPicture(430, 100, rectW, rectH))){
TV_state ^= 1;
port.write(‘F’);
//port.write(TV_state);
delay(500);
}
if(mousePressed && (overCircle(655,450,50)||overPicture(630, 100, rectW, rectH))){
ALARM_state ^= 1;
port.write(‘L’);
//port.write(ALARM_state);
delay(500);
}

//Switches
strokeWeight(1);
fill(0);
if (FAN_state==1)
{
text(“ON”, 100, 463);
fill(0, 255, 0);
} else
{
text(“OFF”, 100, 463);
fill(255, 0, 0);
}
ellipse(55, 450, 50, 50);

fill(0);
if (LIGHT_state==1)
{
text(“ON”, 300, 463);
fill(0, 255, 0);
} else
{
text(“OFF”, 300, 463);
fill(255, 0, 0);
}
ellipse(255, 450, 50, 50);

fill(0);
if (TV_state==1)
{
text(“ON”, 500, 463);
fill(0, 255, 0);
} else
{
text(“OFF”, 500, 463);
fill(255, 0, 0);
}
ellipse(455, 450, 50, 50);

fill(0);
if (ALARM_state==1)
{
text(“ON”, 700, 463);
fill(0, 255, 0);
} else
{
text(“OFF”, 700, 463);
fill(255, 0, 0);
}
ellipse(655, 450, 50, 50);
}

boolean overCircle(int x, int y, int diameter) {
float disX = x - mouseX;
float disY = y - mouseY;
if (sqrt(sq(disX) + sq(disY)) < diameter/2 ) {
return true;
} else {
return false;
}
}
boolean overPicture(int x, int y, int w, int l) {
float disX = x - mouseX;
float disY = y - mouseY;
if (mouseX>x && mouseX<x+w && mouseY>y && mouseY<y+l) {
return true;
} else {
return false;
}
}

THANKS

That looks as if it is Processing code. This is the Arduino forum.

…R