New answers tagged

0

The description you give for the desired behavior is very unclear and hard to follow. I am going to rephrase what I think I understood in terms of a finite state machine, which is the correct way of describing this kind of systems. Please, review the description below, as chances are I did not completely understand what you really want. Let's say the system ...


0

As I wrote in my comment, you can use millis() to solve your problem. First you should ditch the else statement, since you don't want the analog signal to turn the output of. unsigned long timestamp=0; unsigned long interval = 3000; void loop(){ if(millis() - timestamp > interval){ digitalWrite(pin, LOW); if(analogRead(A0) > X){ ...


0

Using different threshold values to switch states - a higher threshold to go HIGH and a lower value to go LOW - is called hysteresis. It makes a dead-zone between the two switching values that prevents jitter, or flickering the LED in this case, that would happen with a single switch-point and the analog value was very close to it. To do that, you just need ...


0

If the USB chip is hot, you are out of luck.


0

You will most likely find nobody here, who will write the code for you, since this is not a free code writing service. But I will suggest a good way. I just need the relay to trigger every 4h for 5min The phrase "every x hours" screams for using the modulo operator %. Modulo gives you the rest value of an integer division. See these values: 0 % 4 = 0 1 %...


3

While writing this answer, I found out about the register emulation of the Arduino Uno Wifi. The Uno Wifi is a different chip, than the Uno, thus you have different registers. But the Uno Wifi was thought as a drop in replacement, so register emulation maps the old register names to the new registers, so that you can basically simply reuse the old code for ...


0

Not sure if this is just an academic exercise on your part to learn (which is totally cool), but if you're just trying to move forward and get something working you may consider one of the many excellent button libraries out there for Arduino. I recently used a library called ButtonKing that allowed me to do some very sophisticated menu interactions on a ...


5

Yes, it is different. First: Never run a motor directly from IO pins - you will damage your Arduino. Not only can a real Arduino not supply enough current, but motors generate a lot of back-EMF that will kill an Arduino. Secondly a pin doesn't connect direct to GND or VCC - it is connected through a MOSFET that performs the switching. That MOSFET has an ...


1

In the real world, either pin sinks current to Gnd via an onchip N-channel MOSFET. They will safely sink 20, 25mA. If your motor allows more than 40mA to flow, you risk damaging the pin and likely the whole chip. Similarly, either pin can source the same current to a load, likely via P-channel MOSFET, with the same current limitations. Using both together, ...


0

While this isn't the right way of doing it I'm sharing the way that I figured it out. Step1: cd c:\ dir tcp.h /s c:\Program Files (x86)\Arduino\hardware\arduino\avr\firmwares\wifishield\wifiHD\src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip c:\Program Files (x86)\Arduino\libraries\WiFi\extras\wifiHD\src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\...


2

You are calling setCursor() with: //Row, Colum lcd.setCursor (0, 4); lcd.print(DiceOne); lcd.setCursor (1, 4); lcd.print(DiceTwo); While your comment notes the order is Row, Column, there appear to be several LiquidCrystal libraries floating about, some of which use Column, Row order in the SetCursor() function. The official Arduino library source ...


1

It seems that your issue is probably connected with LCD timing. Sending data to LCD requires a precise timings, and the onboard chip of the LCD module very much like a few milliseconds of time to finish processing the data sent, instead you pass the entire clear and draw command each loop cycle. I used the default Tinkercad LCD display example. This code ...


0

In most cases the problem is in low balance and account settings. As I see, you doing all right. AT+CGATT=1 AT+CSTT="TATA.DOCOMO.INTERNET","","" Also, check login/password! It's unusual to have blank credential here, in my country.


2

static public int recordings[99999999] = {NULL} This is not valid C code. Remove the word public. Also you cannot create such a big array. The Arduino has only 2 KB (SRAM) memory and also since it is static you have to fill it with values directly, like: static int recordings[5] = { 0, 1, 2, 3, 4 }; How many values you want to store? In case you need ...


0

Please correct your code there are several mistakes, such as the lines at beginning of loop SensorR = digitalRead(2); SensorL = digitalRead(3); SensorM = digitalRead(5); doesn't make any sense.. as you not defined 2,3,5 pin as input. And for taking analog input please change pins 2,3,5 and analog pins.. Motor Pin M1 and M2 are connected 12,13 which are not ...


1

The Servo library uses timer 1 to send the signals to the servos. But timer 1 is also used to run PWM on pins 9 and 10. It can't however do both. So since Motor E1 uses pin 10, and timer 1 is already used by the Servo library, PWM, and by extension, analogWrite doesn't work. E2 uses pin 11, which uses timer 2 for it's PWM, so is therefor no affected. So ...


0

That error basically says the bootloader you are trying to burn does not appear to be for that device. This could be due to corruption or (more likely in your case) harvesting and reconfiguring the hardware. If the error does not appear when you try to load the bootloader for the Uno (original device you harvested it from for those harvesting from other ...


1

You can temporarily put it in an UNO. Don't connect this UNO via USB, but use jumper wires to connect the ISP pins plus the power pins to the other Arduino that you are using as an ISP programmer. (You could also use the (2x3) ISP header on the UNO if that's more convenient.) Or, you could use a high voltage programmer. Or get/desolder a crystal from some ...


2

The first argument of setPixelColor is is the number of the led. In your case 0, so the first led. Instead use a for loop to set all the leds from 0 until (excluding) 24 (which is stored in NUM_LEDS). void loop() { for (int led = 0; led < NUM_LEDS ; led++) { strip.setPixelColor(led, 255, 255, 255); } strip.show(); delay(1000); for (int ...


7

You read the contents of flash and save it to a file. It can then be re-flashed if your need is not to edit, but duplicate. This reads all flash, including the bootloader, and also PROGMEM data. Use avr-objdump (or similar) to disassemble the instructions. Again, PROGMEM data is going to be interpreted as opcodes, and may not be valid opcodes. You may ...


8

You never can get the actual code back ... by reading the flash you might be able to get the executable/runtime code, but this doesn't look at all similar as your code, although it's functionally the same. For example, all function names, all variable names will be just numbers (or non recognizable names), and all C statements are converted in machine ...


17

The short answer: You don't. With enough know-how, you could probably extract the executable binary from the Arduino, but the source code is not installed on the device. You would need to run a decompiler on the binary. (Or read the machine code directly.) The output of a decompiler is usually pretty ugly however, and will look quite different from the ...


1

As pointed out by Majenko in a comment, you can hardly define a standard facility for error reporting when you don't know what kind of I/O hardware will be available on any particular project. Printing to the serial port is the most common method though, as it tends to always be available during the development phase, while the Arduino is tethered to the ...


1

I'd suggest creating an array of MIDI button structs. For each entry you'd have a button object, an LED pin, and a BOOL to track the state of thate button. Write a function that loops through the array of structs, checks the state of each one, and does the work to play/stop the notes and toggle the LED states based on the state of each button.


2

Following the KISS principle, I have recently published the Instructable "Simple Multi-tasking in Arduino on any board" It covers non-blocking delays, non-blocking serial output, non-blocking user input, removing delays from third party libraries, and loop timers, so you can see and adjust the response/latency of your tasks. Here is some example code ...


0

There is a library you can include that debounces buttons Bounce2. Here is a test sketch that debounces a button and lets you change the "state" of a variable. // Connect one end of a N.O. push button switch to // GND and the other end to pin 2 of the Arduino. #include <Bounce2.h> byte buttonState = 0; const byte modeButtonPin = 2; const unsigned ...


0

The arduino has more than enough processing power to manage those tasks mentioned. You probably won't need that 555. Playing music is possible as long as the arduino doesn't have to process the file itself. But switching on an external player is no problem (with what so ever circuitry). The electrical power is another story, you probably will need extra ...


Top 50 recent answers are included