Hot answers tagged

9

It's not the data type, it's the printing routine that sets that limit. In Print.cpp: 227 if (isnan(number)) return print("nan"); 228 if (isinf(number)) return print("inf"); 229 if (number > 4294967040.0) return print ("ovf"); // constant determined empirically 230 if (number <-4294967040.0) return print ("...


3

If you want the display to persist, you should call drawScreen() on every loop iteration. You will need a variable for “remembering” what glyph you should draw. Then, the serial-processing code has only to update this variable when a new character is received: // Remember which glyph we should draw. byte *glyph = Zero; void loop() { if (Serial.available(...


2

For your needs you don't need actual UARTs. You can do it all with normal GPIO pins and one (or more) interrupts. UART communication is characterised by having a "start bit" at the beginning of all bytes. That is, in TTL terms, a transition from HIGH to LOW. You just need to look out for that transition. You could: Use Pin Change interrupts on 6 ...


2

Building on @snakeNET's answer (which I regard as function overload rather than polymorphism)... A more generic way would be to pass in a pointer to Print, allowing any Print related class to be used (not just Serial); also pass objects by reference e.g. void types(Print* p, const String&) { p->print("it's a String"); } // for each type ... ...


2

Arduino uses the DTR line (data terminal ready) So, with the Arduino Serial Monitor it is not possible to change the restart when established the rs232 connection. But I'm using for example the freeware "HTerm" (under Windows). By default, it does not use the DTR signal. Meanwhile I changed to the freeware "CoolTerm" (a bit more ...


2

There are a few issues at play here. One is that the Arduino resets every time you open the serial connection on the PC side. You can prevent this by putting a 1 µF (or more) capacitor between 5V and RESET. A second issue is that the tty driver may be keeping old data in its buffer, and you get this data when you open the connection. The third issue is that ...


1

A USB connection is actually very complex. And serial communications (or the CDC class of USB) is only 1 of over a dozen protocols used over USB. Most cheap embedded processors save money by leaving out this feature. Most Arduino's use cheap embedded processors. For instance, the classic Arduino Uno needs a second chip (search for New USB in this link) ...


1

Your drawScreen() function executes very quickly and therefore, lights the LEDs once, very briefly. There are a few choices; here are a couple to try: One is to write surround the existing for{} loop in drawScreen() with another one, to redisplay the digit enough times to make it visible. Experiment with the count of the outer loop starting with, maybe, ...


1

I removed free(value) - rookie mistake - but that didn't completely solved the problem (but reduced frequency of occurrences). Seems like declaring array like char val[50] and passing it to function as char* val was a bad idea. I changed array declaration to char *val = new char[50] and now seems like everything works fine.


1

It sounds rather like a fault with the Nano's CH340 chip, the one used to communicate over USB between the Nano and a PC. The Atmega 328p seems to be working, as you say the previously loaded Morse Code program still runs. I expect you can still program the Atmega entirely through its ISP. If the CH340 has been physically damaged, you can still program the ...


1

#include <DES.h> DES des; byte in[8]; String input; char buf[30]; void setup() { Serial.begin(9600); Serial.println("Hello!"); } void tdesTest() { byte out[8]; byte key[] = { 0x3b, 0x38, 0x98, 0x37, 0x15, 0x20, 0xf7, 0x5e, // key A 0x92, 0x2f, 0xb5, 0x10, 0xc7, 0x1f, 0x43, 0x6e, // key B 0x3b, 0x38, 0x98, 0x37, 0x15, ...


1

From your comments I think I understand what you are after. So, assuming you have read some string into a String object called input and you have an array in[8] to populate you can: Clear the in[] array to a preset state Copy the string content into in[] As code: memset(in, 0, 8); // Erase the contents of in[] input.toCharArray((char *)in, 8); // Copy up ...


1

I'd say pyFirmata can work but controling servos ... NOPE! use pyserial and add the code


1

All that has happened is that you don't have a sketch running. When you have a board with a native USB connection a sketch has to be running to make that USB connection be anything. You corrupted your sketch, so it's not executing. All you need to do is manually trigger the bootloader to install a new sketch. According to the "Getting started" page:...


1

There is an issue with the way in which the data is sent and received because it assumes the transmission will remain perfectly synchronised for the lifetime of the programme. Consider what would happen if one byte were to be dropped due to a communication error – the x and y data would be swapped for further transmissions. Original Sender void loop() { // ...


1

update in 2021, similar problem, fastLED causing unintelligible IR codes, adding that while loop: while (!irrecv.isIdle()); // if not idle, wait till complete just before the ir check worked for me, not 100% of the codes are correct but more than good enough for my use, you life saver


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