Using DS2408 I/O pins as outputs

Hello!

I'm working on a project where I need to use some pins on the DS2408 as outputs. I have seen multiple topics where people have tried to figure it out but I could not find a useful answer.

There is a example sketch in the oneWire library where you can read all inputs but I still haven't been able to find a good example where you write to the ports and use them as outputs instead.

It would be very much appreciated if someone who knows a bit more about the DS2408 could make an small example sketch where the pins is used as outputs instead of inputs:)

Does the information in this post help you out?

Do you need to use 1-wire? For distance or some limitation to the number of wires in a cable or something? If not, 2-wire, also known as i2c, is far more often used and better understood and supported with Arduino. For example pcf8574 or mcp23008.

Yes, as I understand 1-wire is the only protocol where there is very few wires, no need to define id's, capability for okay transfere distance and the ability to add a lot of devices at ones.

It is needed for a prototype for a storage concept where the amount of DS2408 IC's can vary after how many "boxes" you connect to the system. The system will then automatically handle the connection after plugin by searching after new devices on the 1-wire bus.

I have read the topic but it sadly did not help me find the answer to my problem.

The link posted by @markd833 has example code which uses the ds2408 pin as outputs, and is reported to work. Why did this not help you? It is exactly the short example you asked for.

There is no complete answer. There is just a piece of code and a description witch says that there was needed to be modified in some libraries as well to make it work

Ah, you mean this?

At first, I got some errors, but after editing the DS2408.cpp and DS2408.h library, I got it clean and working! :smiley:

What errors do you see?