HIH6130 address change - syntax errors in example code

I want to make sure that I understand what I just programmed before I end up screwing the remaining 2 sensors.

This is how my current Project code looks like. (Not the Command Mode code) I need to rewrite it to use all the parts together.
This is just a bunch of example code for given hardware thrown together without syntax errors or interference.

Can I remove the semicolon in this statement: address = 0x27;; ?

I still have questions about those sensors. What am I programming into them?
I want to set all the alarm bits to high/low, just so I know what I am doing.
I DONT WANT to screw up any factory settings.

The Command Mode code offers me an option of screwing up the sensor, I feel.
I want other people to be able to use that example safely.

Thank you!

BASE_PROJECT.ino (13.4 KB)

Can I remove the semicolon in this statement: address = 0x27;; ?

Yes. A semicolon terminates a statement. In this case, the second semicolon terminates a null statement which isn't useful.

I still have questions about those sensors. What am I programming into them?

Where?

I want to set all the alarm bits to high/low, just so I know what I am doing.

Best thing to do is make a series of small sketches which only deal with that one sensor and which try various functions until you get them to work.

I DONT WANT to screw up any factory settings.

All you have to do, BEFORE you play around with the settings, is exactly what the datasheet tells you to do:

Read and store the original EEPROM contents before modifying them in case the sensor must be returned to its default condition.

I want other people to be able to use that example safely.

What example? What exactly is it you are trying to do?

Pete

I am trying to build a system that controls humidity and temperature in an enclosed growing vault.
Currently I want to grow mushrooms.

This system would use an Arduino microcontroller, LCD screen, capacitive touchpad, a toggle switch, a (maybe) rotary encoder and RTC and several solid state relays to energize and to disconnect loads.

Stage 1)
I want all sensors to work and for this system to act as a simple thermostat, hygrostat, switch lights on and off. The humidifier consists of a fan and an ultrasonic humidifier head. Those two loads are not energized at the same time. The heater is a PTC heat trace cable that is wound on the inner structure of my system. It maxes out at 60 degrees Celsius for safety. Yet it will need to be controlled via a TRIAC for a smooth, wear-free operation.

Toggle switch will tell the system to go into the "spawn" or "fruit" mode for growing mushrooms.

Stage 2)
I would like my system to operate from a table of values and to log temperature, humidity, lights state data. Growing conditions need to change as the plant or fungus matures. This curve is unique for every plant specie or fungus specie. Yet it is very predictable for a specific growing method.

Stage 3)
Connection to a computer, similar to this:
https://www.instructables.com/id/Arduino-Plant-Monitor/
A growing community, similar to The Internet of Things.

I can go on vocation and check the conditions of my green house from my phone.
I would be able to exchange growing data with other enthusiasts.

Stage 4)
A large website that would tell users how to build growing systems, offer several modules for different growing system scales. Expansion into specialized growing automation, such as robots that plant seedlings in hydroponics systems, various specialized products.

Technically a whole new branch of industry would be born.

However I can only complete Stage 1. Hardly. I am a very bad coder. I was able to write programs that used arrays and pointers in college. I even got 'A's for my assignments. Now I feel like I lost that ability. Several other things opened up to me that would help me complete this project.

I am a very intuitive hardware engineer.

BASE_PROJECT.ino (13.4 KB)

I did not back up the data that was in sensors EEPROM before I wrote things to it.
I still dont know how to save EEPROM data, set alarm flags.

I guess I will have to buy a new sensor if the sensor I played with behaves erratically after all this trial and error programming.

I cannot read the datasheet. It specifies different addresses for bit locations then addresses that are used in the program.

I feel like the memory in the datasheet is different than the memory structure of the actual device.
(This would also explain why there are so many libraries for HIH6130 that dont work)

I looked at the code and the datasheet for hours and I was not able to draw any parallels between the two.

I just want an example that I can work with that would tell me what bit in the memory changes what,
in Arduino code.
Or in bytes, where every byte would be written out in binary and I could see what digit corresponds to what.

A good educational example would back up data before address change takes place. It would be wise to write an example that specifically tells what bits should not be changed, with their addresses.
Such example doesn't exist. This is a problem.

Right now I am talking about the Command Mode code. This code only changes address once, for every sensor.
It doesn't need to be a part of my main project.

HIH_Commander_Mode_2.ino (6.94 KB)

How do I set alarm flags in my sensors with a given code?

How do I back up factory data that was pre-loaded into the sensors?
How do I write that data back?

Thanks.

Is anybody else stuck with HIH6130 ?
Or is this part so unpopular that I am the only one who uses it?

How do I save data from sensor EEPROM?

How do I upload data that I copied from sensor EEPROM?

Is there a code that would allow me to change the address without interfering with other data settings?

Is there a single code that can do all this?

THANK YOU