Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
/********* Pleasedontcode.com ********** Pleasedontcode thanks you for automatic code generation! Enjoy your code! - Terms and Conditions: You have a non-exclusive, revocable, worldwide, royalty-free license for personal and commercial use. Attribution is optional; modifications are allowed, but you're responsible for code maintenance. We're not liable for any loss or damage. For full terms, please visit pleasedontcode.com/termsandconditions. - Project: **EEPROM Access** - Source Code NOT compiled for: Arduino Uno - Source Code created on: 2024-11-07 08:37:48 ********* Pleasedontcode.com **********/ /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* interfacing eeprom and intigrate with builtin one */ /****** END SYSTEM REQUIREMENTS *****/ /* START CODE */ /****** DEFINITION OF LIBRARIES *****/ #include
/****** FUNCTION PROTOTYPES *****/ void setup(void); void loop(void); /****** GLOBAL VARIABLES *****/ int addr = 0; // Current address in the EEPROM for writing int address = 0; // Current address in the EEPROM for reading byte value; // Variable to store the read value void setup(void) { // Initialize serial communication for reading values Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for native USB port only } } void loop(void) { // Write to EEPROM int val = analogRead(0) / 4; // Read analog input and scale EEPROM.write(addr, val); // Write value to EEPROM addr++; // Advance to the next address if (addr == EEPROM.length()) { addr = 0; // Wrap around if at the end } // Read from EEPROM value = EEPROM.read(address); // Read a byte from EEPROM Serial.print(address); // Print address Serial.print("\t"); Serial.print(value, DEC); // Print value in decimal Serial.println(); address++; // Advance to the next address if (address == EEPROM.length()) { address = 0; // Wrap around if at the end } delay(500); // Wait before next iteration } /* END CODE */
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)