Introduction: Mouse Control Arduino Uno on the Pc

Picture of Mouse Control Arduino Uno on the Pc

A kurzor vezérlése 2 potméterrel arduino uno-val.

The cursor control 2 potmeter with arduino uno.

Step 1: Bekötése/Assembly

Picture of Bekötése/Assembly

A 2 potméter helyes bekötése :

baloladli láb 5 V

középső láb analog

jobb oldali láb GND (föld)

Példa a képen.


left pin 5 V

middle pin analog

right pin GND (ground)

Example in the picture

Step 2: Programozás/Programing

Picture of Programozás/Programing


int pot1;

int pot2;

void setup() {



void loop() {

pot1 = analogRead(A0);

pot2 = analogRead(A1);

Serial.print( pot1 );


Serial.println( pot2 );




import java.awt.*;

import javax.swing.SwingUtilities;

import java.awt.MouseInfo;

import java.awt.Point;

int xx =0, yy =0, nxx =0, nyy =0;

Robot eger; //(en) Robot mouse;

import processing.serial.*;
Serial port;

void setup(){

try{ port = new Serial(this,"com9",9600); //com= arduino com (Arduino ide -> Tool -> Port:"comX"


} catch(Exception ex){

text("Nincs soros \n port komunikáció!",10,14); //(EN) " There is no serial port communication!"

} try {

eger = new Robot(); //(EN) mouse = new Robot();

} catch (AWTException e) {

println("Nem támogatott a robot class!"); exit(); //(EN) "Not Supported robot class!"


}void draw()

{ System.out.println("("+nxx+", "+nyy+")"); nxx=MouseInfo.getPointerInfo().getLocation().x; nyy=MouseInfo.getPointerInfo().getLocation().y;}

void serialEvent(Serial myPort) {
String bejovo = myPort.readStringUntil('\n');

if (bejovo != null) {

bejovo = trim(bejovo);

int[] potik = int(split(bejovo, ","));

if (potik.length >=2) {

if (nxx>xx+20 || nyy>yy+20 || nxx<xx-20||nyy<yy-20) { xx=nxx; yy=nyy;delay(250); }

xx= potik[0]; yy=potik[1]; eger.mouseMove(xx,yy); }

} } }

Step 3: Bemutató\Premiere


RohanS113 (author)2017-04-21

It's not working with me!
it is working with mouse not with pot!
help me

MátéL (author)RohanS1132017-09-13

Hello what problem ?

Botir94 (author)2016-12-10

Thank you for this job and I want ask you how I can open downloaded file

MátéL (author)Botir942016-12-10

Hello you need a processing program downloaded the side

( i have processing version 2.2.1 version)

and an Arduino to program on their side

arduino program code to arduino ide

pocessing program code to processing program

in processing executable exe or mac os or sh linux files made
File -> exportapplication-> change your platform

I hope I could help you.

AbdullahM10 (author)2015-12-03

awesome job thank you (y)

MátéL (author)AbdullahM102015-12-12

Thank you :)

About This Instructable



More by MátéL:Mouse control arduino uno on the pc
Add instructable to: