Hot answers tagged

3

You need to review your code and also the capabilities of the Arduino UNO. int declares an integer. So int duty = 0.5; is going to get rounded to either 0 1. delay(0); also will not work. The instruction will simply get skipped. Likely the reason why you get a brighter LED. Try to use delayMicroseconds(); if you need shorter time but the minimum delay ...


2

Look at the back of the module. There are 3 groups of 3 solder pads each, marked with A0, A1 and A2. With these pads you can set the 3 least significant bits of the address. On the images in your product link these pads are unconnected. The middle pin is the address pin. The left pad (which is connected to a trace) is Vcc, the right pad (which is connected ...


1

This is not a complete answer, but an idea of how to accomplish the task. I just typed it in without testing the code. Use arrays to hold variables. That way a loop can be used to service the three sensors and the three LEDs.. for (i = 0; i<3; i++) { currentTime = millis(); // ...


1

You are misinterpreting how the onReceive callback works. The millis() code like in the BlinkWithoutDelay example relies on the fact, that it is run repeatedly very fast, so that effectively the time is checked regularily very fast. The onReceive callback is only called once every time, that the Wire library received an I2C message, from an interrupt ...


1

In your button() function, the line if (current and not last) { is less common syntax. The more common equivalent is: if (current && !last) { (see https://stackoverflow.com/questions/2376448/the-written-versions-of-the-logical-operators) This line: current == last; Has no effect and is incorrect. This ( “==“ ) is not an assignment but a ...


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