Arduino Mega and Nextion display Serial communication - arduino

I'm working on Arduino Project using Nextion Display. At first It worked perfectly Arduino used to read and write data to display shown component, but for some reason Nextion doesn't send data to arduino anymore, I checked the Voltage supply common gnd, and wiring is perfect (TX ==> RX2 , RX ==> TX2).
I'm using Nextion Library which is working bu default for Arduino Mega , so no change is necessary.
here is the link to nextion library: https://github.com/itead/ITEADLIB_Arduino_Nextion
I'm sure the code doesn't contain any problems. It's all about serial communication from nextion display.

I have found out that the Nextion Display becomes unresponsive if you have any delays in your loop.
In several parts in the library there are timeouts of 100 millis if you have a larger time out like delay(120) you receive no data at all.
Furthermore the Library you are pointing to is related to using Serial2 look at my solution at github Serial1 or Serial2 in external library reference
This will solve your problem.

Related

Is it possible to factory reset an arduino from hardware to remove bad user code?

I was troubleshooting why Serial1 was always throwing undefined errors in sketches I was trying to run when I found a solution posted online for a slightly different board that suggested this line:
HardwareSerial Serial1(2);
I uploaded it and now the Arduino doesn't show up in the IDE, did I remap it's serial communications? Why is this possible!
Is there any hardware factory reset option available on these boards? Did I just brick my device?
edit: It seems the STM32Cube programmer app can be used to communicate with the device but I'm not sure where to get the original firmware to flash. https://imgur.com/a/LbiHenf
Assuming from the tag in your question, I guess you have an STM32 – (BluePill) Development Board (STM32F103C8).
If you think that your board is not handling serial communication properly then you might consider burning bootloader to your board. This will reset the complete configuration of your board.
There are many ways in which you can burn bootloader to your board.
Using another Arduino board like Uno / Nano / Mega
Using an FTDI USB to TTL Serial Adapter.
You might want to go through tutorials list below:
Getting Started with STM32 using Arduino IDE: Blinking LED
Programming STM32F103C8 Board using USB Port

Arduino with the use of LCD i2c adapter (Error Receiving Data)

Good day!
I'm currently working on a device with Arduino UNO, NFC/RFID Module v3, esp8266 and LCD with i2c adapter. The process is TAP card, read card data then send via wifi.
Here's the scenario, the code is working fine without the LCD library. I have used the LEDs as my indicators whether my data has been sent or not. Then I decided to use LCD as my visual indicator.I put the library of the LCD i2c and its corresponding code in my previous sketch (which is perfectly working). Successfully compiled and uploaded the sketch. Although it appears that the data has been successfully sent, but the data were not received by the web.
I have tried removing the code of the LCD i2c again, then the device is really working. Successfully sent the data and all.
Here's the link LCD library that Im using: https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library/tree/master/examples
What are the possible ways to correct this problem? Thank you very much.
Here's some part of my code with LCD:
https://i.stack.imgur.com/BtuBP.jpg
Everytime I add the code for LCD like this one:
lcd.setCursor(4,0);
lcd.print("RELOADER");
,data has been sent successfully but was not received.
Removed that part again and data was received.

ESP8266 Arduino 2.2 TFT ILI9341

I recently got one TFT LCD from aliexpress which supports SPI and uses ILI9341.
This is the one.TTT ILI9341
I have the ESP8266 EspressoLite 1 board, and I am using ESP8266 Arduino. (https://github.com/esp8266/Arduino)
I made the following connection :
I made the following connection : SCK #14, MOSI #13, MISO #12 and CS, #4, DC #5,RESET #0
and used the example graphicTest (which is available in the Adafruit_ILI9341-master folder) . I was able to make the display work for a few seconds. In the graphic test, once the line test starts my ESP8266 gets restarted. This was getting repeated .
In my existing project, I used the following code to just show some messages :
Adafruit_ILI9341 tft = Adafruit_ILI9341(4, 5, 13, 14, 0, 12);
tft.begin()
tft.fillScreen(ILI9341_BLACK);
tft.setCursor(0, 0);
tft.setTextColor(ILI9341_GREEN); tft.setTextSize(4);
tft.println(message);
The message is shown once a response is sent back from ESP. This works for a couple of times and then it again gets stuck and reboots.
I am not sure whether I am using the optimised library for ESP8266 for this LCD or whether there is any as such.
I read in forums and could see that there were some adafruit libraries in the ESP8266 Arduino but now that it is not available and only some TFT_Touch_Shield_V2 are present.
Has anyone faced the same issue or can tell me a better way to make this display work with ESP8266 Arduino.
Thanks in advance. !!!
Even i had somewhat the same problem.
There's a library called 'UTFT' which works fine on the device. Try using the library. Thats the best for esp and ILI9341.
Also, you can try using delay() or yield() functions in between.
The esp8266 may restart itself due to the watchdog when a loop a takes long time to process.

GSM Module code Not Working On GSM breakout board

I'm in a situation and need some advice.
Scenario 1:
Arduino Uno/Genuino +
ICOMSAT SIM900 Module(http://www.itead.cc/icomsat.html)
(placed the jumpers such that Digital Pin 2 is rx and 3 is TX on the shield)
Code Used: The send receive SMS example code in the arduino website.(
(https://www.arduino.cc/en/Tutorial/GSMExamplesReceiveSMS)
Everything Works fine without a glitch.
Scenario 2:
Arduino Uno/genuino +
GSM breakout board(https://www.google.co.in/search?q=sim900A&espv=2&biw=1600&bih=717&source=lnms&tbm=isch&sa=X&ved=0CAYQ_AUoAWoVChMIqd748qb8yAIVYXumCh2s2Aaq#tbm=isch&q=sim900a+gsm+module&imgdii=9zJcFQBaoLAKzM%3A%3B9zJcFQBaoLAKzM%3A%3B7eDw6qGc3qZjMM%3A&imgrc=9zJcFQBaoLAKzM%3A)
Had loads of issues with softwareSeial.h library and ended up cross connecting the default on board rx/tx with GSM board's RX/TX and everything worked fine. (though I didn't liked the fact that everytime during programming I had to change connections to upload a sketch)
code used is from here (http://www.theengineeringprojects.com/2014/06/send-sms-with-arduino-uno-and-sim900d-using-at-commands.html)
Now my Problem:
Since the shields are very costly, I decided to settle on the cheaper boards for my project. But the Code used for the GSM shield was so easy to understand (since the library was doing all the heavy lifting) I tried to use that. I connected Rx of GSM board to pin 3 and TX to pin 2 of arduino and uploaded the same code I used for the GSM shield scenario. But the code won'r work, I tried to tinker a few blocking things like the enable pin code where the shield is brought up etc. but no luck. Can anyone put some light on it, has this been tried before, is it not supposed to work the was i want it to ?
Thanks a lot in advance.

How do I add Xinput to a gamepad arduino project?

I have successfully running push buttons and analog sticks working on a board of mine through the serial connection via the Arduino IDE. How do I get that data to work with Xinput?
I have my own emulation software that works in Xinput beyond that. I just need to get the gamepad device xinput support. What are the neccessary steps to get this working with a driver and how I can get this up in running in the least amount of timing possible without having to edit someone else's driver too much?
You can turning an Arduino Leonardo into a joystick, use a teensy board and the teensy joystick library, use a HID-compatible bluetooth chip (such as RN-42 HID or something similar) with a joystick/gamepad profile or just remove a controller's existing joystick parts and replace with your components.

Resources