New answers tagged

0

Would like to thank everybody for their advice, but want to give @Edgar Bonet credit for the answer. The link he provided jorisvr.nl/article/arduino-frequency said it all. The resonator is fine for most applications not requiring extremely precise timing, but for high speed comms or nano/micro second event-timing a crystal is a better option. Given all ...


0

'pixelGrid[]' are longs but your temp inside the for() loop, 'data', is an int. Thus, it gets only half the data. Easy mistake to make (and they can be so hard to spot when you know perfectly well what you meant... :) Update: By switching the int to long, I've successfully unlocked a seventeenth column! Unfortunately, it looks like all the pixels are ...


0

Your interrupt code looks reasonable, except that once you set flag to true you never set it back to false again. You need a way to identify the the IR sensor is no longer active. Perhaps change your interrupt to fire on a change of state and set the flag to true when it switches to LOW (like it does no) and false when it switches back to high? I'd need to ...


1

The problem here is that Serial.parseInt() stops when it sees the newline, but it does not consume that newline, which is left in the input buffer. Thus, at the next loop iteration, Serial.available() returns true because of this newline and, unless you send another value fast enough, Serial.parseInt() times out and returns zero. The easy fix is to consume ...


1

Your problem is that you are confused about the meaning of gear. One possible meaning could be 0 = neutral, 1 .. 5 = gear. But then, when changing gears you can't simply do + or -, as the sequence is 1 - 0 - 2 - 3 - ... The other interpretation is: gear-- from 2 means neutral and you display something that indicates neutral ( e.g. a '0' or a '-' ) ...


0

I often use a timer loop to read sensors. I've attached some code, which compiles, however I don't have the sensor. BTW. I am assuming it is a single shot IR sensor that returns 0 if something is detected. int out1 = 5; //motor int IRSensor = 3; // connect ir sensor to arduino pin 6 int LED = 6; // conect Led to arduino pin 9 int Switch = 2; int ...


0

Likely problem I'm not sure how to solve the problem, however, I see at least one item that looks strange in the //neutral part: gear = HIGH; This seems gear is a pin status (LOW/HIGH), but two lines above: if ((val_n == HIGH) &&gear<=2) Here gear is an integer value. This seems quite inconsequent to me. Pin 4 The reason is you do not have ...


0

You are overflowing your buffer, and also allowing garbage reads. First you need 5 bytes for your buffer not 4, and you need to ensure it is zeroed out before using it. This is because you are treating it like a C string, which means it must b zero terminated. Secondly your use of Serial.readBytesUntil() is flawed. From the manual: The function ...


2

I see a lot of 'almost' repetitions like : if (RelaySourceDigi == 7) { shifter.setPin(16, LOW); shifter.setPin(17, LOW); shifter.setPin(18, LOW); shifter.setPin(19, LOW); shifter.setPin(20, LOW); shifter.setPin(21, LOW); shifter.setPin(22, HIGH); shifter.setPin(23, LOW); shifter.write(); lcd.setCursor(0, 2); lcd....


0

You are disabling interrupts for way too long. Interrupts are meant for handling time-critical tasks that cannot wait for a full loop iteration. If you ever disable them, it should be for a time as short as possible. In your case, you only need to disable interrupts while accessing the pulseCount variable, as this variable is shared between the ISR and the ...


0

Timekeeping isn't exact with any of the boards, though .05% - just over 7 minutes/day - doesn't sound like too high an expectation. Restarting when you connect it to your computer is by design and doesn't indicate a fault. Opening the IDE's terminal or connecting another terminal program to a connected and running Arduino will - and is supposed to - reset ...


1

Your first problem is the definition of the text array: const char *pc[NUM_ZONES] = { "TIME", // This will be replaced by real time its only for logic of rows here "ROOM", "SUBJECT", "CLASS" }; then we need a timer, as you only show minutes we only have to change time in that interval to prevent flicker and other unwanted effects and hour for ...


0

here's an expression that strips every character that is not ( alpha numeric or space character, or period character) that is also Followed by an alpha numeric or space or period and replaces it by capitalising the following character. find ./ -depth | perl -wan -F'/' -e ' chomp; chomp($F[-1]);$x=$_; if ($F[-1]=~m/[^\p{Alnum}\d \.]/ and substr($F[-1],0,1) ...


1

You can connect all the grounds together and the circuit will be safe. If the BEC outputs 5V, you can feed it directly to the Arduino's 5V pin. Any more volts and you'll need to feed the BEC output to the Arduino's VIN pin.


0

Yes, you can. If you have the adaptor board for it as shown in the video. The key item from the description to note is the driver chip: SSD1309 That is what you need to know to find a library and connection schema.


1

You pass flowreading to void getflows (int sensor, float range, float flowreading) as a value and therefore changing flowreading has no effect on the variable you pass to that function. Instead, you need to do void getflows (int sensor, float range, float *flowreading).


1

In this case, the description on Github says specifically that it is compatible with the Uno: Based on the work in http://www.instructables.com/id/Use-an-Arduino-with-an-N64-controller/ here comes a comfortable library for usage with e.g. Arduino Uno. If you know in advance that you intend to write a very large body of code, of which this library is ...


0

What misled me is the pin numbers. I was referencing this diagram: I thought that all the pins were numbered sequentially, so that pinMode(9, ...) would set D6 (09 in the diagram). However, this sets D9. Connecting to the correct pin works fine.


0

I haven't used this library, but reading through the documentation it seems it operates on the concept of zones. Create a zone for each row (a zone is a contiguous block of modules forming a kind of sub-display) Perform operations on the zones with the zone-specific functions. For example, setting up your zones would be: P.begin(4); // We will have 4 ...


3

You only convert the String object to a char array. It need to further split the char array into substring, and then convert it to number. To split the char array, you can use strtok() function in c++ to do the job. There is no str conversion function that can convert "0xff" into uint8_t directly. However, as @rubemnobre mentioned strtol() can be used to ...


2

There are C functions that can convert text to number. For example, strtol() or atoi(). Here is a little snippet to get you started: char *str = "FF"; char *ptr; int result = strtol(str, &ptr, 16); //the 16 is the base the string is in (HEX -> base 16) result will have 0xFF or 255 by the end. You can use this to achieve what you are trying to do. ...


Top 50 recent answers are included