Is it possible to trigger an interrupt with some of my laptop's keys if the laptop and arduino uno are connected via usb?
Where is the interrupt supposed to take place? What's is supposed to do and why?
Please read and use this link: How to get the best out of this forum - Using Arduino / Installation & Troubleshooting - Arduino Forum
The interrupt is supposed to save the time that the key was pressed onto an SD card. I don't quite understand what you mean with where it is supposed to take place.
Are you trying to do something like this product?
In order to do what you want, you would have to be messing at a fairly low level with the system running on the PC.
Or inserting your device between the keyboard and the computer.
a7
Yes this is quite similar to what I am trying to achieve. This part of my project is not completely necessary. Do you think I should just use a push button attached to the arduino instead of trying to make this work?
Well yes, if a pushbutton will suffice, even if only for the moment, a mcuh easier task.
Which would also almost certainly mean not thinking in terms of using interrupts to do, which would further simplify the project and increase odds of earlier success.
a7
The pushbutton should suffice. However it would have been nice to be able to control the arduino via the laptop as my project with the arduino and sensors will be contained in a pelican case. As a result the push button would be one extra thing along with the usb cord that connects the outside world with the pelican case.
Also I don't see how using a pushbutton would not use interrupts.
This is not hard. Your description didn't seem to be asking after that; the product I linked is totally off topic.
You can talk and listen to the Arduino from the PC using a terminal emulator, or a program you write for the PC that uses serial communications.
Start with PuTTY or CoolTerm, respected terminal programs.
Read
For smarter stuff on the PC or MacOS side, look into Processing:
Visualization with Processinf and Arduino.
As for buttons without interrupts, work through the basic examples on offer in the Arduino IDE. You will see no mention of interrupts while you program buttons and LEDs to do, well, just about anything you could think of.
a7
What is the purpose of the terminal emulator? I read what you linked and it seems like I can communicate to the arduino via the serial monitor without the use of the terminal emulator.
Sry. For some reason I thought you were doing something more complicated.
If you want your typing on the keyboard to be received by the Arduino and to there inform the activities the Arduino performs, then using the serial monitor is the simple and easy way forward.
I must have assumed you knew that and had reasons to need something different.
How are you planning to have the Arduino keep track of the time so it can time stamp the stuff you place on the SD card?
a7
The serial monitor IS a terminal emulator. Rather poor one, though.
I'm using an RTC to keep track of time. I'm thinking the code I'll use will look something like this:
myFile = SD.open("test.txt", FILE_WRITE);
if (myFile) {
if(Serial.available()){
input = Serial.read();
}
}
if(input == 't'){
myFile.println(timestamp);
myFile.close();
}
Input will be a char and timestamp will be from the RTC. In my setup, I will also have accelerometers where the data will be written to the SD card. However, I also want to be able to see this data via the serial monitor. Can I use the serial monitor to write to the arduino and receive the data at the same time?
You can send characters to the serial monitor from the Arduino. One way is to use the print() or println() function.
The Arduino can receive You can receive characters typed in the serial monitor. One way is the read() function.
a7
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.