EasyManua.ls Logo

SunFounder 3in1 Kit - Funny Project

Default Icon
351 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
SunFounder 3in1 Kit
4. About the EEPROM library.
Here are some of its functions.
write(address,value): Write a byte to the EEPROM.
address: the location to write to, starting from 0 (int)
value: the value to write, from 0 to 255 (byte)
An EEPROM write takes 3.3 ms to complete. The EEPROM memory has a specified life of
100,000 write/erase cycles, so you may need to be careful about how often you write to it.
Read(address): Reads a byte from the EEPROM. Locations that have never been written to
have the value of 255.
update(address,value): Write a byte to the EEPROM. The value is written only if differs
from the one already saved at the same address.
An EEPROM write takes 3.3 ms to complete. The EEPROM memory has a specified life
of 100,000 write/erase cycles, so using this function instead of write() can save cycles if the
written data does not change often
EEPROM.put(address, data): Write any data type or object to the EEPROM.
address: the location to read from, starting from 0 (int).
data: the data to read, can be a primitive type (eg. float) or a custom struct.
This function uses EEPROM.update() to perform the write, so does not rewrites the value if
it didn’t change.
EEPROM.get(address, data): Read any data type or object from the EEPROM.
address: the location to read from, starting from 0 (int).
data: the data to read, can be a primitive type (eg. float) or a custom struct.
4.6 6. Funny Project
In this chapter, you will find some examples that illustrate the basic logic of how most programs interact with reality.
This will help you become familiar with Arduino programming. When you have a creative idea in mind, programming
will no longer be challenging for you.
4.6.1 6.1 Light-sensitive Array
A photoresistor or photocell is a light-controlled variable resistor. The resistance of a photoresistor decreases with
increasing incident light intensity; in other words, it exhibits photoconductivity. A photoresistor can be applied in
light-sensitive detector circuits, and light- and darkness-activated switching circuits.
The resistance of a photoresistor changes with incident light intensity. If the light intensity gets higher, the resistance
decreases; if it gets lower, the resistance increases. In this experiment, we will use eight LEDs to show the light intensity.
The higher the light intensity is, the more LEDs will light up. When the light intensity is high enough, all the LEDs
will be on. When there is no light, all the LEDs will go out.
Required Components
In this project, we need the following components.
Its definitely convenient to buy a whole kit, here’s the link:
194 Chapter 4. Basic Projects

Related product manuals