New answers tagged

1

There does seem to be a method called SetReport in the USBHID class, which looks like it takes the same arguments, which I'm trying to use. The method arguments of the new SetReport() method aren't quite the same and some are in a different order. The old method signature was: uint8_t setReport( uint8_t addr, uint8_t ep, unsigned int nbytes, uint8_t ...


0

A Mega has 8 KB of memory. You are using: double (same as float on an Arduino, see double) , 4 bytes * 420 elements * 2 arrays = 3,360 bytes int (2 bytes) * 89 = 178 bytes In total this is 3,538 bytes This is about 50%, so I'm unsure what the 'rest' is. You can take a look at the other related question that may show some answers (like using dynamic memory, ...


0

I remember a formula that calculated luminance (perceived brightness) using simple weights applied to the red, green, and blue values in a light source. This formula allows for the fact that the human eye is most sensitive to green light and least sensitive to blue light. The Wiki article on HSV/HSL has these different weightings for R,G, and B. (In all of ...


0

There is no simple way to have a formula from the RGB values to intensity. Also, there is intensity that can be measured with an intensity meter/sensor, but what people (humans, or each individual) consider more intensity (perceived intensity) is not fully related. However, some things I found when I had a similar problem: Typically a LED value of 0 is OFF, ...


3

A CPP file isn't an Arduino file. It doesn't know about anything Arduino-esque unless you tell it about it. The simplest way is to just add, at the top of the file: #include <Arduino.h>


1

You can print the value as it is: Serial.println(state); This will print the the ordering number of the enum, but you can specify the value as any number or char. enum States { SLEEP = 'S', AWAKE = 'A', CRAZY = 'C' }; Now if you print it with cast to char Serial.println((char) state); it will print a character, which in my opinion is much better then ...


2

It seems you got confused by the pointer indirections, which is confounded by the implicit indirections made by the compiler. Here: extern "C" void __attribute__ ((used, noinline)) call(func_ptr *ptr) { (*ptr)(); } The parameter ptr is not a function pointer: it's a pointer to a function pointer. You have to dereference it twice in order to ...


2

I will start off by saying that I am no expert in AVR assembly, so I have no idea if any of this is actually correct. However from reading the various documents on the subject I have gleaned: On the ATMega2560 EIJMP uses a combination of both the Z register and the EIND register to form a full address. That means that as well as setting up the Z register ...


3

1 << 31 is interpreted by the compiler as (int)1 << (int)32. See the implicit types of integer literals. The rules of usual arithmetic conversions state that no implicit conversion is performed in this case. The result is then computed as an int, and it overflows. Note that this is undefined behavior. The assignment int64_t a = ... converts the (...


0

try to download this library in this link and insert it to your ide, it works for me. https://github.com/adafruit/DHT-sensor-library


Top 50 recent answers are included