program with a physical button instead of the mouse.
Hello Chris,
I've completed the robot. It's working. Here I want to start the robot's program with a physical button instead of the mouse. What can I do for this?
Thanks...
const int buttonPin = 2; // Buton pinini belirtin (örnekte 2 numaralı pin kullanıldı)
const int ledPin = 13; // LED pinini belirtin (örnekte 13 numaralı pin kullanıldı)
int buttonState = 0; // Buton durumu değişkeni
void setup() {
pinMode(ledPin, OUTPUT); // LED pinini çıkış olarak ayarlayın
pinMode(buttonPin, INPUT); // Buton pinini giriş olarak ayarlayın
}
void loop() {
buttonState = digitalRead(buttonPin); // Buton durumunu okuyun
if (buttonState == HIGH) { // Buton basıldığında
digitalWrite(ledPin, HIGH); // LED'i yakın
delay(1000); // 1 saniye bekle
digitalWrite(ledPin, LOW); // LED'i söndür
}
}
___________________________________________________________________
@Chris (https://anninrobotics.com/community/questions/program-with-a-physical-button-instead-of-the-mouse) Annin is it possible with this code? is it ok if i install teensy4.1? Can you test this?
5 replies

Chris Annin
That is a good idea and one that has been brought up several times. The main issue is that the commands are fed and executed from the windows PC so its hard to have a physical button on the teensy that tells the computer to start sending moves from the command line. I will keep thinking about a way to make this happen. I have thought about trying to find a way to upload the actual motion program to the teensy board and then running without the PC but this will take some development. Let me know if anyone has any ideas on this and I will add this to my list of future updates.