PRACTICAL VIDEO
CIRCUIT OF TRANSMITTER
SIMULATION
Matlab code
import java.awt.Robot;
import java.awt.event.*;
mouse = Robot;
s = serial(‘COM6′);
set(s,’BaudRate’,9600,’DataBits’,8,’Parity’,’none’,’StopBits’,1,’FlowControl’,’none’,’InputBufferSize’, 1);
s.Terminator = ‘CR’;
s.BytesAvailableFcnMode = ‘byte’;
set(s, ‘Timeout’,1);
s.ReadAsyncMode = ‘continuous’;
fclose(s);
fopen(s);
s.BytesAvailable
display(‘Opened……….’)
fprintf(s,’Press the required keys from the micro controller’)
x=650;
y=350;
screensizex=1600;
screensizey=900;
while(1)
n=fread(s)
s.BytesAvailable
if (n==82)
if (x<screensizex)&&(y<screensizey)
%mouse.mouseMove(x, y);
x=x+3
if (x<0)
x=0
end
mouse.mouseMove(x, y);
end
elseif(n==76);
if (x<screensizex)&&(y<screensizey)
%mouse.mouseMove(x, y);
x=x-3
if (x<0)
x=0
end
mouse.mouseMove(x, y);
end
elseif(n==70)
if (x<screensizex)&&(y<screensizey)
%mouse.mouseMove(x, y);
y=y-3
if (y<0)
y=0
end
mouse.mouseMove(x, y);
end
elseif(n==66);
if (x<screensizex)&&(y<screensizey)
%mouse.mouseMove(x, y);
y=y+3
if (y<0)
y=0
end
mouse.mouseMove(x, y);
end
elseif(n==83)
mouse.mousePress(InputEvent.BUTTON3_MASK);
mouse.mouseRelease(InputEvent.BUTTON3_MASK);%Right click
elseif(n==84)
mouse.mousePress(InputEvent.BUTTON1_MASK);%Left click
mouse.mouseRelease(InputEvent.BUTTON1_MASK);
end
end
fclose(s);
delete(s);
clear s;
MIKRO C CODE
int a,b;
void delay1(void);
void main()
{
ADC_Init();
uart1_init(9600);
Delay_ms(100); // Wait for UART module to stabilize
UART1_Write_Text(“Start”);
while(1)
{
a = ADC_Read(0); //FOR X – AXIS
Delay_ms(1);
if(a>400) {UART1_write(‘R’); delay1();}
if(a<310) {UART1_write(‘L’);delay1(); }
b = ADC_Read(2); //FOR Z- AXIS
Delay_ms(10);
if(b>500){ UART1_write(‘S’); Delay_ms(300); }
if(b<250) {UART1_write(‘T’); Delay_ms(300);}
b = ADC_Read(1); //FOR Y- AXIS
Delay_ms(10);
if(b>380) {UART1_write(‘F’); delay1(); }
if(b<300){ UART1_write(‘B’); delay1(); }
b=0 ;
b = ADC_Read(2); //FOR Z- AXIS
Delay_ms(10);
if(b>500){ UART1_write(‘S’); Delay_ms(300); }
if(b<260) {UART1_write(‘T’); Delay_ms(300);}
}
}
void delay1(void)
{
Delay_ms(20);
}