set values then change and save them by button push

lets say i set value
float a = 10000
and i want to change that value via button press but once i turn off arduino it saves the changed value my question is how to go about doing this i have very limited knowledge of programing

Search "saving to EEPROM"


DarkZero: lets say i set value float a = 10000 and i want to change that value via button press but once i turn off arduino it saves the changed value my question is how to go about doing this i have very limited knowledge of programing

This project will take you a while then.

You can save to on-chip EEPROM (electrically erasable programmable read only memory) and maybe in later projects, save to an external SD card in an adapter but that takes a lot more code.

Arduino floats use 4 bytes each and EEPROM reads and writes 1 byte at a time. You can copy the 4 bytes of the float to 4 bytes of EEPROM and as long as you copy them back in the same order it will work.

ok let me first ask if this is right way to do this i actually need to make voltage measurment as precise as possible so i wanted to as some sort of calibration so i looked at arduino as voltage meter and you just make voltage divider and its all fine but u actually need to measure supply voltage and resistors in voltage divider and if u add potenciometer instead of one resistor you could calibrate it but since you write in the values in the code i tought why not program it to change the value to make "software" potenciometer

is this viable or im just wasting my time ^^

Arduino (really the AVR chip) has a pin that you can apply an external reference voltage to for ADC.

There is an internal 1.1V source (the pins compare to to know where LOW threshold is) that you can compare small voltages to with the same 0 to 1023 but 1.1V or less measures.

From the ATMEL datasheet for the 328 family available on their website:

The ADC converts an analog input voltage to a 10-bit digital value through successive approximation. The minimum value represents GND and the maximum value represents the voltage on the AREF pin minus 1 LSB. Optionally, AVCC or an internal 1.1V reference voltage may be connected to the AREF pin by writing to the REFSn bits in the ADMUX Register. The internal voltage reference may thus be decoupled by an external capacitor at the AREF pin to improve noise immunity.

24.5.2 ADC Voltage Reference The reference voltage for the ADC (VREF) indicates the conversion range for the ADC. Single ended channels that exceed VREF will result in codes close to 0x3FF. VREF can be selected as either AVCC, internal 1.1V reference, or external AREF pin. AVCC is connected to the ADC through a passive switch. The internal 1.1V reference is generated from the internal bandgap reference (VBG) through an internal amplifier. In either case, the external AREF pin is directly connected to the ADC, and the reference voltage can be made more immune to noise by connecting a capacitor between the AREF pin and ground. VREF can also be measured at the AREF pin with a high impedance voltmeter. Note that VREF is a high impedance source, and only a capacitive load should be connected in a system. If the user has a fixed voltage source connected to the AREF pin, the user may not use the other reference voltage options in the application, as they will be shorted to the external voltage. If no external voltage is applied to the AREF pin, the user may switch between AVCC and 1.1V as reference selection. The first ADC conversion result after switching reference voltage source may be inaccurate, and the user is advised to discard this result.

Arduinos are only 10 bits. Here is a 41/2 digit for not too much more money: keysight U3401A

If you have relatively long periods to make the measure in then you can roll your own analog measure by loading the V to test into a resistor-capacitor network and count the number of digital reads it takes to bring the pin low which could be 1000's or more, much more, the longest count is the resolution and the setup needs to be calibrated but on the bright side it's wide open to adding resolution through oversampling as long as the V being measured does not change.

Another option is to get a high-res ADC chip and wire that to your controller.

Just be aware that the closer you must measure, the more noise-free your circuit must be. It is not much good getting highly precise measures of signal plus self-induced noise. Just because you can read 16 bits doesn't make it 16 bits of good data, that part is up to you.