Not quite ...
Looking at that bit of code:
uint8_t myVal[4] = {0xDE, 0xAD, 0xBE, 0xEF};
This defines an array of 4 bytes (uint8_t => unsigned 8 bit integer type) and puts the value 0xDE into myVal[0], 0xAD into myVal[1] etc.
for (int x = 0 ; x < 0x0400 ; x += 4)
{
myFlash.writeBlock(x, myVal, 4); //Address, pointer, size
}
This loop causes the integer x to increment from 0 in steps of 4 (x +=4 is the same as x=x+4) for as long as x is less than 0x400 (i.e. 1024). So it's actually going to go round the loop 256 times. Each time round the loop, it calls the myFlash.writeBlock() function to write 4 bytes from the array myVal to the flash chip at address x. So the address x increments 0,4,8,12,16,20 etc.
What you could do to avoid exposing yourself to a lot of the inner workings of how numbers are stored in memory, is to define a structure to hold 1 set of your values.
Now I've written this off the top of my head so hopefully it will work and I've not mucked it up and wasted you time - but if I have mucked it up, then maybe someone else will jump in and correct me!
#include <SparkFun_SPI_SerialFlash.h>
SFE_SPI_FLASH myFlash;
// edit this structure to hold one set of parameters you want to log
struct oneRecordType {
int recordNumber;
float temperature;
float pressure;
} oneRecord;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
oneRecord.temperature = 17.0; // 17 degC or 17 degF - you decide
oneRecord.pressure = 1012.25; // millibars - or in Hg if you prefer
oneRecord.recordNumber = 0;
Serial.println("Writing test values to first 1024 bytes");
for (int x = 0 ; x < 0x0400 ; x += sizeof(oneRecord) )
{
myFlash.writeBlock(x, (uint8_t *)&oneRecord, sizeof(oneRecord) ); //Address, pointer, size
oneRecord.recordNumber++;
}
}
void loop() {
// put your main code here, to run repeatedly:
}