New answers tagged

0

what actually happens with this code is when I put something near the sensor <= 5 , the led is on without i removed the thing , but I want the led on when I put then remove the thing Here is my theory on what happens here. You can confirm it by using one of the solutions, that I will explain below. Currently your code is measuring the distance as fast as ...


3

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: ...


1

thank you for your suggestion. The issue isn't with the code but was with the button. I changed the button and it worked fine. Thanks for the help!


0

Azure IoT is only supported on ESP8266 and ESP32. As stated in the README for the library: Currently supported hardware: ESP8266 based boards with esp8266/arduino SparkFun Thing Adafruit Feather Huzzah ESP32 based boards with espressif/arduino-esp32 Adafruit HUZZAH32


1

What happens if the while condition fails? i.e. if millis() - time is greater than or equal to 20. Is this what you intended? If there's too much other stuff in the while loop, it may quit it and never re-enter it. loop() I've added a call to a function that prints debug information. unsigned long time = 0; void loop() { DebugMsgTime("loop() begin&...


0

Add the flag -vvvv to the avrdude command. That will show you the flow of data between the computer and the Arduino. You can copy and paste the executed command from the IDE and run it in a terminal / command window adding the flag manually. Or you could modify the platform.txt file for the AVR core.


1

Hmm the solution is how the code is written...no fancy stuff...the KIWI way //in setup function add tft.fillScreen(ST7735_GREEN); void loop(){ int lightIntensity = myBH1750.getLux(); tft.setTextSize(3); tft.setCursor(10,10); tft.setTextColor(ST7735_RED); tft.print(lightIntensity); delay(3000); tft.setTextColor(ST7735_GREEN); tft.setCursor(...


2

You can use them for any purpose other than PWM. You can even use them for PWM as long as the settings for the timer allow you to produce the waveform you want. The reason PWM broke was that you had changed the settings for the timer. The timer is what controls the PWM. When you changed those settings you either turned the PWM function off or set some ...


2

As Majenko already stated, the second image shows a custom display. It is not pixelated, because each shown element/symbol has it's own element in the LCD. When you have one of these displays, you might be able to reuse it for your project, but that is advanced. In the case of pixel based displays with a significantly higher resolution than the standard ...


3

Your sampling rate is far too low for the signals you are looking at; you're not getting enough data points for drawing something that looks like the original signal. The Arduino library's analogRead(), while slow, can do better, up to about 9000 samples/s; the ADC in the atmega2560 in free-running mode can do about 75000 samples/s at 8 bits resolution. This ...


4

The image is incorrect, unfortunately. The SPI pins are below: PB0 - #SS PB1 - SCK PB2 - MOSI PB3 - MISO


0

You are declaring float data_storage_array[600][3] in setup(), and using it in another function, that can't "see" it. The simplest way of making it work is making your array global by declaring it at the top in the section where you declare other variables like max_load.


2

Your problem is your usage of sizeof(). It doesn't do what you think it does. sizeof() gives you the amount of memory a variable takes up. It does not give you the number of elements in an array. For example: const int ONE[]={2,6}; sizeof(ONE) will not give you 2. It will give you 4. An int is two bytes in size (16 bits). An array of 2 ints is, therefore, ...


0

This looks like another case of serial spam. I recommend changing to a frame-based approach and controlling that rate with checks to millis. That limits the spam. Alternative is to limit it outright to 1: //a static global: static int isaidHELLO = 0; //later in the loop if (Serial1.available() > 0) { gps.encode(Serial1.read()); if (gps.location....


1

Floats in the Arduino IDE are normally 4 bytes. So you can work out with a calculator that your matrix will take at least 15 x 15 x 4 bytes (900 bytes). That is out of a total of 2048 bytes of RAM on the Atmega32. That may seem to be enough RAM, but other things, like the libraries, will also take RAM. I did an answer to a question about RAM a while back. ...


2

Functions must have a body. So instead of: void setup() You need: void setup() { // do nothing } You have other issues, for example this is not C++: int (n,i,j,result); That should be: int n,i,j,result; Also you are returning 0, when void functions don't return a value. Also, here: printf("enter N Value"); scanf ("%d", &...


0

The line: HX711 scale; is called the "instantiation of the object". It creates a new object called scale which is an instance of the HX711 class. It is this "object" that is your interface to the HX711 physical device. To use two of them you first need to have two objects - one for each HX711. You can name them whatever you like. For ...


1

As per the comments your output shows that the chip is working "normally" in that it reacts to the chip detector sketch. Thus the bulk of the design/implementation is OK. Referring to Engbedded Atmel AVR® Fuse Calculator your fuse settings means the processor is expecting an external crystal oscillator. The bootloader expects (I think) a 16 MHz ...


1

If you define instance as a global value, how about to set callback with using lambda expression as variable of constructor. #include <ros.h> #include <std_msgs/Empty.h> class ROSController { protected: ros::Subscriber<std_msgs::Empty> sub; ros::NodeHandle nh; public: ROSController(void (*staticPRYCallback)(const std_msgs::...


Top 50 recent answers are included