8

After a chat with OP, it turned out this was a more complex issue, probably a memory overrun. This cannot be seen in this small snippet, but the whole program is using memory extensively (global variables and dynamic memory heap allocation). Heavy use of String variables is a likely explanation for the observed behavior. Also a lot of string literals are ...


5

It sounds like the primary issue is how you've connected the two shift registers. You just need the bit shifting out of the first one to shift into the second one so they act, together, as one longer shift register. The example pictured is described in full here, under the heading "Example 2": http://arduino.cc/en/tutorial/ShiftOut As Klaus mentioned, you ...


5

You don't connect shift registers as a tree. That would be awfully slow. Instead, you connect them as chains. Shift registers are meant to be chained by connecting the serial out of one register to the serial in of the next one, while both registers share the latch and clock lines. You can chain as many as you want this way: a chain of four 8-bit shift ...


4

You can chain as many shift registers as you want. Most commonly, these displays are multiplexed. Only one digit is lit at a time, cycling though all the digits fast enough, so the eye can't tell. This is however not very good practice for 28 digits, as the brightness will become 1/28th (though you could create groups of digits, and multiplex those groups ...


4

I have done exactly this, to great effect. int clockPin = 4; int dataPin = 2; int oePin = 3; // Here are the digits from 0 to 9, as bitmaps. // You will need to work out which segments are which, // according to your wiring, and make your own. unsigned char digitmaps[]={0x7b,0x11,0xe3,0xb3,0x99,0xba,0xfa,0x13,0xfb,0xbb}; void setup() { pinMode(...


4

Seems you have I²C on the board you could possibly use an I²C LCD backpack, like from breakouts if you already have an LCD, this means you can have the RTC and display on the I²C bus and probably more things. Another option seems you mentioned LEDs, you could still use the I²C bus and use an I/O expander and hook LEDs up to that and address them over the I²...


4

First of all, fix the following part of your code: if (Qout[i]){pinState= 1;}//Checks the array for the value and if it is true sets the pinstate to 1, HIGH else{pinState= 1;}//If it equals false set it to 0, LOW into: if (Qout[i]) { //Checks the array for the value and if it is true sets the pinstate to 1, HIGH pinState = 1; } else { //If it ...


4

You mean something like this? (untested): void loop() { // use static or global variables to remember positions (these are initialized only once): static uint8_t hi_pos = 0; // where HIGH should be set static uint8_t lo_pos = 21; // where LOW should be set setRegisterPin(hi_pos, HIGH); // turn on led in head setRegisterPin(lo_pos, LOW); // turn ...


4

You should change your capacitors. You only have 0.1µF instead of 1µF for the bulk capacitor (which really wants to be 10µF). In addition you should add 0.1µF (100nF) capacitors directly across the power pins of each chip:


4

Have you looked at OneWire temperature sensors? You connect them to a bus IC and the bus IC to your Mcu. This allows you to multiplex many sensors. You can also forego the master bus IC and just bit bang using a GPIO pin. The Arduino OneWire library uses this approach. You can learn a lot about from this one wire sensors tutorial.


4

As I mentioned in the comments, one way to do this is to use a multiplexer. You haven't said which temperature sensors you are planning to use, so I'll illustrate this example using the TMP36 Analogue temperature sensor. Now, if you were using just one of these, the connection would be trivial: But you want more sensors than available pins. That's where ...


4

Serial.read() is going to give you ASCII codes. So when you send 1 from the serial monitor the Arduino receives 49. Note that the ASCII code for a digit is the same as the digit plus 48, so that sets bits 4 and 5 high. You can use Serial.read() - '0' to get the actual number from the ascii code.


3

It is extremely confusing to have a variable val and then use _val in your function but then: shiftOut(dataPin,clockPin,LSBFIRST,val); As James pointed out, you are not sending the value passed to the function, to the shift register. Also this is just going to give you a boolean: updateRegister(!i); Why take "not i" there? I suggest you use SPI and ...


3

shiftOut is slow, yes. It is basically "bit banging" a synchronous serial interface, which is a bit daft really when the Arduino has a hardware synchronous serial interface built in that can operate at much higher speeds. That built in synchronous serial interface is called SPI. I suggest you switch to SPI instead of shiftOut. Also you should check what ...


3

This looks like a classical case of pin conflicts when merging several sketches. In this case it is hidden by the fact that TWI SDA and SCL are separate pins on the Arduino Leonardo. But they are also connected to pins 2 and 3 (not A4 and A5 as on Arduino Uno). Selecting other pins (latch/data) for the third shift register should help. Cheers.


3

In this data sheet it says: When the output-enable (OE) input is high,the outputs are in the high-impedance state. However on page 3 you will notice that the *OE pin controls all outputs at the same time. So if you connect 2 output pins and one is high and the other is low and you hold *OE low ... you will likely burn out the driver for one of the 2 ...


3

I have forum post about the 595 chip and a question and answer about SPI. You can use SPI to do the transfer. This is faster and simpler than shiftOut. Also you need to bring the latch low before transferring the data. Simple example sketch: #include <SPI.h> const byte LATCH = 10; void setup () { SPI.begin (); } // end of setup byte c; void ...


3

The main problem you seem to have is how to implement shiftOut. Well, that's actually quite simple once you understand how shiftOut actually works. You already know how to set a pin HIGH or LOW - all you lack from that is the concept of time. All shiftOut does is set the clock and data pins HIGH and LOW at the right time. It's simply a case of: Set the ...


3

I can only think about two things: (least probably): the entrance (VCC) voltage is too high. (most probably): the resistors to the LEDs are (too) low .. Recalculate the values and check the max amperes which can be handled by the output pins of the shift registers.


3

You are correct that a lower resistance would offer higher brightness. The more current through the LED, the brighter it will be. The current is calculated by dividing the voltage across the resistor by resistance value. The voltage across the resistor would be your 5V - the voltage drop across the LED. this often varies by color. A RED LED might have a 1.2V ...


3

To convert my comments to an answer: You can use the register names directly. They are defined in the boards/chips core. To read them, simply use the names in your calculations. Write to the registers by setting the value of the registers name (like a variable: TCNT0 = 0;). Be sure to look into the datasheet, to check the behavior of that register.


2

Solution: Remove ground from Q0 as Gerben correctly pointed out in comments. Also: rotate LEDs 90 degrees so that the anode and cathode are on different rows. What was tripping me up is in the Arduino tutorial diagram is a little unclear on this (I now understand why their way is correct and my way (in the question) was wrong:


2

I have few SPI ADC which have forced SPI bus down to 1 Mhz. I understand that the shiftout works at 14Khz which is too slow. You can change the SPI speed at any time. Once the device is selected (Slave Select asserted) then reconfigure the SPI bus for high speed operation. eg. SPI.setClockDivider(SPI_CLOCK_DIV2); SPI is definitely the fastest way you can ...


2

The 7-segment display board is all very well, but that displays 4 digits. That isn't exactly 5 LEDs. In any case that board has a chip on it, if you are going to buy another chip you may as well get an Attiny and use that. Just have serial input (same as the 7-segment board did). On the Attiny you have 8 pins, 3 of which will be reserved: Vcc, Gnd, Reset. ...


2

There isn't really a best way (and such questions are usually discouraged as they can easily descend into argument). Personally I would go for chaining all of the '595s together so you only ever use the 3 pins; it gives you the opportunity to use a smaller MCU like the ATtiny when you put it all on a board later which makes it (slightly) cheaper and (...


2

0.20A is not the maximum current for an Arduino device. 0.20A is the maximum current for the chip that is on the Arduino. Thus it is only relevant to devices that are directly connected to the Arduino's IO pins (that connect direct to the chip). The shift registers take their own power from the +5V pin, which is limited to between 500mA and 800mA ...


2

Disconnecting the ground pin was not a solution. It is hard to be certain from video but the resistor values are likely too small because I can't see any color on the bands. They are 100? Look closely at the driver data sheet. It may say an output pin maximum current is +/-35 mA which would suggest that the 100 ohm resistor is okay. For example, a red ...


2

You have misunderstood how shift registers work - and one of the main reasons they exist in the first place. Shift register ICs have a common 'latch' pin which latches the data present at the input of the cell into the cell, thus updating the output. Some ICs also offer an "output enable", which switches the outputs to a high-impedance state irrespective of ...


2

since you already have input, use an 74HC165 8-bit parallel-in/serial out shift register. They are cheap. another cheap option with I/O is an expander like the PCF8574, which are almost cheap


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