Hi im rather new to this kind of arduino use, but im tasked with using an arduino uno to turn off a laptop screen. I have an external proximity sensor that if the user is a certain distance away, the arduino will turn off the screen of my laptop. The code I have so far is pretty simple:
int var = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
var = analogRead(A0);
if (var > 60) {
Serial.println("Please approach booth!");
}
else if (var <= 60) {
Serial.println("Welcome!");
//Turn off screen code here
}
else {
Serial.println("Error!");
}
delay(1000);
}
The sensor resolution is 1 inch per 2 units, so if the subject is 2.5 feet away or more just wait but if they are 0 - 2.5 ft I want the screen off. I am not experienced in using powershell, but I found a bat file that will turn off my screen with a single line.
powershell (Add-Type '[DllImport(\"user32.dll\")]^public static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);' -Name a -Pas)::SendMessage(-1,0x0112,0xF170,2)
Im just struggling on figuring out how to open it. Any ideas?