People who code: we want your input. Take the Survey
8

Important information: Wire.write() does NOT send anything over the I2C lines. It just puts the data into the libraries internal buffer. The actual transmission is then done by Wire.endTransmission(). I2C is packaged transmission protocol. That means, that the transmission is done in confined data packages. In your master code you are calling Wire.write() ...


6

Note: this answer demonstrates using the 2N3904 NPN transistor for all of the calculations, since that's what's in the schematic in the question. However, after writing the answer, I noticed the words at the end of the question state it is a D882P (also an NPN type) transistor. So, just follow my methodology here but use the appropriate values for your NPN ...


6

On an Arduino board with the 328 processor, an INT is stored as a 2 byte value, so the max number is 32,767. You want to use a LONG which is a 4 byte number which has a max of 2,147,483,647. When the variable you are using is not big enough, the number rolls over, which is why you end up getting a negative number.


6

Timer 1 overflows at 255 because that's how it has been configured by the Arduino core, as it is intended to provide 8-bit PWM. If you want to use the timer in normal mode, you should undo the Arduino's initialization by setting TCCR1A to zero. Two comments on the ISR: ISR (ANALOG_COMP_vect) { timeNow = TCNT1; Serial.print (timeNow); Serial....


6

It's enforcing this line from the arduino:avr boards.txt nano.menu.cpu.atmega328.upload.maximum_size=30720 To be clear, the board is assumed to have a bootloader, even if you're not using it to get the code onto the board, that is upload via programmer. You could edit that and change some fuses yourself. But you could also probably just use MCUdude ...


6

Its not as easy as you think. An Arduino will not be enough for connecting the USB of the 3D printer. The USB protocol is strictly divided into slaves and masters. A USB(us) has exactly one master, which totally controls, what the slave can do. The slave itself cannot do much of its own. Your 3D printer is a USB slave device. That enables a USB master (like ...


5

High likely you are exceeding your character array, see: char a[5]; Which can hold 5 characters. However, you write: if(strcmp(a,"RGB_1") == 0) Which assumes you receive "RGB_1" which is 6 characters, because a string ends with a 0. What also might happen is that you indeed receive only 5 characters without the ending newline, which ...


5

It looks like you have the center segment and the top left vertical segment reversed. For the image you show, if you switched the on/off states of those 2 segments, you'd see 1230. I don't know if the problem is in your code or in your wiring. The simplest fix would be to swap the pins for those 2 segments.


4

idk if the arduino stores the code for ever The code is saved in the flash memory, which is non-volatile. It does not lose its content during power cycles. Also, when looking at the time dimension, it holds the code over a very long time, though not for ever. The datasheet of the Atmega328p (the microcontroller in the Arduino Uno or Nano) states: ...


4

Just use a single 1ms timer interrupt and count them. Every 10 interrupts do both things. void interruptHandler() { counter++; // do things that happen every 1ms if(counter == 10) { // do things that happen every 10ms counter = 0; } }


4

A6 and A7 are special on the nano. They are the only pins that can't be used for digital. They are only analog inputs.


4

The limiting factor is the bus capacitance. This is the limit of the total capacitance of the bus from all devices connected to it plus the capacitance of the wires used. It is also affected by the value of the pullup resistors. The limit, according to the specifications, is 400pF. An Arduino has an input capacitance of 10pF. So ignoring the wires that's ...


4

To keep the same brightness, you have to keep the same duty cycle (percent of on time over off time). So to change the rate without changing the brightness, you have to increase delayMicroseconds(onTime) by the same percent you increase delay(strobeDelay). But note that as you go slower, the on time will be too long to freeze the motion you are trying to ...


4

There are 3 LEDS on the Nano 33 BLE: A power LED on pin 25 (yes, you can turn off the power LED programatically); A built-in LED on pin 13; An RGB LED with red on pin 22, green on pin 23, and blue on pin 24. In the variant file, they are given names: #define PIN_LED (13u) #define LED_BUILTIN PIN_LED #define LEDR (22u) #define LEDG (23u) #...


4

Any allocation / de- or re-allocation of memory[1] during run time, will cause the heap (the pool of memory from which those allocations are made) to expand until the heap and the stack grow toward each other enough to collide, at which point one overwrites part of the other with unpredictable results. Strings are allocated from the heap. Strings that are ...


4

On the AVR platform the char type happens to be signed, and it can store numbers in the range [−128, +127]. Thus, when you write char bar = 128; You are asking to store in bar a number that does not fit. It then gets reduced modulo 28 into the value that does fit, namely −128. For the kind of manipulations you are trying to make, I would recommend you use ...


4

My personal preference would be to attach a NOT gate to the RESET pin. This can be constructed very simply from a single NPN transistor (or N-channel MOSFET) and a resistor. simulate this circuit – Schematic created using CircuitLab With the wire disconnected R1 turns on Q1 which pulls the RESET pin LOW. With the wire connected Q1 is turned off, ...


3

The solution to get a board that has built in USB support is not preferred for someone who just wants to use the boards they already have. It is possible to use a board that can communicate with your computer over serial, such as the Arduino Nano, to send data to a Python program which can then turn the input from the Arduino into keyboard presses, etc. ...


3

I wanted to post an update in April 2021 on the status of this question. The SIM800L will work in the US, but T-Mobile is the only carrier that it can interface with. AT&T shut down its compatible towers in 2017. T-mobile will shut down its 2G network at the end of 2022. So, the SIM800L is only good for another year and a half. Maybe you're better off ...


3

Finally find the solution =) You don't have to change the ID vendor or ID product: it is possible to attribute a permanent name with devpath (where the device is plugged) The only downside of using the devpath is that the devices will always have to stay plugged into the same physical port. Answer here:PersistentUSBDevices / Alternative filtering via Devpath


3

Just as a complement to Delta_G's answer: The names TIMSK0, OCIE0A, etc. are already preprocessor macros so, for consistency, it makes sense to define your own preprocessor macros for them. I tend to be lazy and use one of the already defined names, like #ifdef TIMSK0 // support both ATtiny{25,45,85} and ATmega328P # define TIMSK TIMSK0 #endif A const ...


3

Don't use Vin as a logic source. Use the +5V pin. Also, disconnecting the pin is not the same as grounding it. It is "floating". For a proper test, connect a +5V to the pin, and follow it with a Gnd. A floating pin has an undefined logic level. What would work in your case is to have a (say) 1k resistor between D2 and Gnd. That way, the moment you ...


3

Looping the wires through the board and not soldering them is probably your problem. That's not going to make a very good connection. You may get power and ground that way, but digital signals like I2C comms are going to see a LOT of noise.


3

Technically, it is possible to start two PWM outputs at the exact same time on an Uno or Nano. If they are both controlled by the same timer, you just have to update the corresponding control register once with the relevant bits set to enable both channels. For example, you could start outputs 5 and 6 simultaneously, as both are on Timer 0: OCR0A = value; ...


3

If you pealed the backing off the bread board you will find that you have plugged in your green, red and photo resistor wires into one piece of metal. This means they are shorted together and as such do not work as you might expect. Also, be aware that photo resistor or cadmium sulfide cells are slow to react to changes in light. Sometimes taking about a ...


3

I think your problem is here: if (RTC.read(tm)) { display.printTime(tm.Hour, tm.Minute, true); } This code displays the current time, and it runs on every single loop iteration. This is visibly not what you want. Your project should have at least two distinct operational modes: “display the current time” and “allow the user to input data”. You ...


3

Your current signal will also show PWM, so you will need to filter that before measuring. It would be much simpler if you could rearrange your circuit to put the sense resistor on the ground side of the MOSFET, since then you can use a simple RC filter and a single A0 measurement. Also, you wouldn't have to worry about the no-load voltage from the solar ...


3

Thank you all for your contributions. I managed to find the issue and solve the intermittent reset. I was expecting to find a hardware problem as the root cause, but just in case it was software related I wanted to check as well. It turned out to be hardware Gil is certainly questioning the correct piece of hardware. It was indeed the wiring of the Prox ...


3

Although you already have two perfectly valid answers, I will share a trick that completely sidesteps the problem. Instead of choosing a particular number (here, 10,000) as a “magic” value that has a special meaning, you can instead initialize the highs and lows in a way that ensures they will be updated on the very first iteration: make lTemp higher than ...


3

If your goal is to "talk" to a computer vs. a human, then a format that can be parsed easily is better than one that is easy to read. For example, you have: I received: 255 I received: 247 I received: 11 I received: 0 While this could be parsed by your Uno, it will be a lot simpler if you send the data something like: 255|247|11|0 Now you can use ...


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