New answers tagged

3

Here's an example of how to do it: jump_table.ino int func1(int arg) { return arg + 1; } int func2(int arg) { return arg + 2; } int func3(int arg) { return arg + 3; } int func4(int arg) { return arg + 4; } int func5(int arg) { return arg + 5; } int func6(int arg) { return arg + 6; } int func7(int arg) { return arg + 7; } int func8(int arg) { return ...


0

Ah, one of my friends pointed out the issue. It's a scope snag: chunks is allocated on the stack in get32BitInt By returning a pointer to chunks, you are pointing to memory that is deallocated. Think of it as pointing to a member variable of a class that has already been destroyed when you try to dereference deallocated memory, bad things can happen. ...


1

My DaquinOscope https://www.daqarta.com/dw_rroo.htm uses the open-source DaqPort sketch https://www.daqarta.com/dw_rraa.htm to sample in batches, then transfer the data to the host in one high-speed blast. It takes 1024 total samples, which in your case of 2 channels would be 512 per channel. It stores only the raw data, unscaled... the host is the place ...


3

Storing the data into arrays is not an end in itself. The question is: what do you want to do with these arrays? The way to proceed depends on that purpose. If you want the data acquisition (analogRead()) and the processing (computation and printing) to proceed in parallel, then you will need the arrays for buffering the data between those two processes. As ...


1

You can create two arrays, e.g.: #define MAX_LENGTH 20 volatile float _gauge0[MAX_LENGTH]; volatile float _gauge1[MAX_LENGTH]; volatile int _filled = 0; The _filled value shows that _gauge0 is filled from 0 upto (excluding) _filled. So when adding two values you use: _gauge0[_filled] = some value; _gauge1[_filled] = some_other_value; _filled++; After ...


Top 50 recent answers are included