40

The error cascade is caused by the missing opening curly bracket { at the start of the thirtyBullets() function. This causes the function name to be not declared and also the following function calls to digitalWrite() to fail. Putting in this missing opening curly bracket should fix all the errors (though I cannot test it since I don't have a compiler at ...


12

After trying numerous suggestions, 2 different boards, 3 different cables on a WinXP and a Win7 machine, I finally got things working by going to "Tools -> Processors -> ATmega 328P Old Bootloader"


9

As noted in Majenko's answer, the Arduino IDE doesn't provide a breakpoint mechanism but Atmel Studio does support breakpoints.[*] However, if you have a switch and an LED, you can track the progress of your program in a way that provides some of the benefits of breakpoints. You would add a subroutine, say BPReport(), that via serial output or an LCD ...


8

Can we read and get C codes from compiled codes from Arduino hardwares? While it is possible, even trivial, to disassemble machine code, it is very difficult to convert the assembly code into a higher-level language, and essentially impossible to turn it back into an exact copy of the source code it came from. There simply isn't enough information in the ...


8

You've found the bug, but how could you have found it easier? The most important step mentally is to accept that you did something wrong. We don't know yet what, but it is exceedingly unlikely that the compiler complains about correct code. So the question is: What did you do wrong? The compiler complained about a function "thirtyBullets". It didn't ...


6

One approach is to look at the assembly listing of the program. After compiling the program (via the Verify or Download button) locate the directory where the .cpp, .hex, and .elf files for the program have been stored. (If you have trouble finding them, briefly turn on verbose compile options in the arduino IDE and look at the directory names in the ...


6

The ATmegaXX8 does not support JTAG, but the ATmegaXX0, 'XX1, and 'XX4 do. The 'XX8 (as well as other AVR families) supports debugWIRE, which allows debugging over ISP. You will need one of Atmel's debuggers such as the AVR ONE! or the Atmel-ICE as well as Atmel Studio in order to use it.


6

int laastButtons[3]; // save the previous deBounce read. for(int x; x<4; x++) { laastButtons[x] = lastButtons[x]; Well, there's a common bug right away. An array with three slices, numbered 0, 1 and 2, and you're accessing them with a loop that counts from 0 to 3. Spot the error. Also, in the for loop, what number does it start counting from? And ...


6

The Arduino Uno uses the Atmel Atmega328p microcontroller, which only has one debug option, DebugWire. There are a few tools that can work with it, but the least expensive and most commonly available is the AVR Dragon. You can use AVR Studio 6 for this. You can use the .elf file file produced during the Arduino build process directly, but setting up the ...


4

Casting a number to a char* doesn't convert the number to a string. Instead it converts the number to a pointer and starts reading chars from that location. Either pass the number to a String constructor, or pass it through ltoa(). EDIT: String ss(...); or char ss[11]; ltoa(..., ss, 10); Also, don't forget to allocate memory for finalss and NUL-...


4

Assuming you have enough time and money to spend on this project. ($50 is a bargain for a debugger, believe me. About a decade ago I wrote an assembler/debugger suite for a very small niche market microcontroller, the Maxim Integrated MAX1464, using a combination of SciTe and Perl/Tk. Writing your own debugger is a great educational project, if you have the ...


4

I found it! I was returning an int8_t variable from my mod function, causing me to not be able to iterate over more than 126 LEDs. Now this little Arduino Uno is maxing out it's RAM at 409 LEDs!


4

As somebody else suggested, 9V batteries are pretty weak. They only provide a very small number of mAh (milliamp/hours) before their voltage starts to drop. Once the voltage drops to around 7 volts, the regulator in the Arduino can't keep providing 5 volts, so your Arduino resets. Wire up 6 AA batteries in series. That will provide a much "stiffer" 9 volt ...


4

On Ubuntu, I usually simply do stty -F /dev/ttyACM0 raw 9600 cat /dev/ttyACM0 > the.log.file Replace 9600 with your baud rate of choice.


4

Though Majenko his answer is correct there are some other options. As to the real hardware debugging as stated by majenko I would say: Install and use a real IDE, such as Atmel Studio or the arduino eclipse plugin called sloeber (I'm author), and Use a full hardware debugger or hardware that has it on board like the Arduio zero or hardware using other ...


4

The Arduino-Debug library provides a simple on-target debugger for Arduino sketches. Debug command are added directly to the sketch. A debugger command shell is started on break-points and assertions. The screen-shot above shows the example sketch run on an Arduino Mega with Serial output monitor used by application and Serial1 used for the debugger shell. ...


4

The Servo library uses Timer 1 to create the servo control signal. That means it can run the servo on any pin or combination of pins, and at the 50Hz speed that a servo likes best. However, pins 9 and 10 also use Timer 1 to create the PWM signal. It can't do both. As soon as you start using the Servo library you lose PWM on pins 9 and 10. So what can you ...


4

For convenience, here is a comment: You wrote, “I've tried the code above but it didn't work”. That is inadequate to convey what happened and what you wanted to happen. Please edit your question to include a clear statement of symptoms and desired results. Now on to an answer. From “I'm only using 2 readers to find the correct and make it work”, I ...


3

It would probably help if you were using the right pin. In the pins_arduino.h file for the Uno is this diagram: // +-\/-+ // PC6 1| |28 PC5 (AI 5) // (D 0) PD0 2| |27 PC4 (AI 4) // (D 1) PD1 3| |26 PC3 (AI 3) // (D 2) PD2 4| |25 PC2 (AI 2) // PWM+ (D 3) PD3 5| |24 PC1 (AI 1) // (D 4) ...


3

The Due (more specifically the SAM3X) uses its own proprietary protocol. It's all embedded in the bootloader, which is hard wired in the ROM and can never be changed (idiotic if you ask me). I know of two systems for communicating with it. Atmel's SAM-BA program, and the open source BOSSA. The command line version of BOSSA (bossac) is used by the Arduino ...


3

Not in the Arduino IDE. You need to: Install and use a real IDE, such as Atmel Studio, and Use a full hardware debugger There is no provision for debugging through the UART/USB interface using the bootloader.


3

You seem to have been programming in Java recently, because many of your errors have a Java ‘whiff’ to them. This, as you’ve tagged, is C++, not Java. sendMouseState: a. You wrote leftPressed == true. This is much more simply expressed by the expression leftPressed. b. You wrote middlePressed == false. This is much more simply expressed using the “not” ...


3

Without very specialized software that can create two new devices with the correct "teeing" policy, it's not going to be possible. Only one program can open a serial port at a time (certainly and have it get anything intelligible out of it...) I would suggest you may want to add a second serial port. Use an FT232 adaptor to communicate on another serial ...


3

You have installed the Adafruit DHT library via the Arduino library manager The source code does not work with that library. It is written to use the DHT library written by Rob Tillaart, named DHTLib. That library is not included in the Library Manager of the Arduino IDE. Instead, you have to download the library as a ZIP file and install it via Sketch / ...


3

If you want to run the Arduino sketch on your desktop, you just have to implement the Arduino core library for your PC. It may not be as bad as it sounds. If your program makes only minimal use of the Arduino core, you may implement only the parts you really need. For example, this partial implementation is enough to run your program: #include <cstdint&...


2

You read the button once, in setup(). The function is not called every time the variable's value is read, only when the line is executed and the variable assigned to. Move the digitalRead() call and assignment into loop(), before you check the variable's value.


2

I finally found it: Problem was solved after commenting those three lines in */Arduino-like IDE/app/uploader.py: if force_to_reset: pre_serial_port = serial_port wait_for_upload_port = self.args.get('upload.wait_for_upload_port', 'true') == 'true' serial_port = resetSerial(pre_serial_port, self.output_console, wait_for_upload_port) # if self....


2

Aaaaah, ok, now I see... You put +5V - Reed - LED - input pin - 1k resistor - ground right? If so the problem is that a red led has (usually) a voltage drop of about 1.5V, while the green one has a voltage drop of 1.8V-2.0V. The Atmega 328P has a Vih (i.e. the minimum voltage needed for a reliable high) of 0.6*Vcc, so for a 5V supply this value is 3V. ...


2

You could get your program to output messages to the serial pin on your board, Tx. For example: Serial.begin(9600) //baud rate of 9600 Serial.print("Debug Message"); You can use this to print out string and integers. Here is the link to further information on the Arduino website - https://www.arduino.cc/en/reference/serial If you are already using the ...


Only top voted, non community-wiki answers of a minimum length are eligible