Skip to content

Commit 79a6d1a

Browse files
committed
update README with GODMODE()
1 parent 41f00d4 commit 79a6d1a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,26 @@ unittest_main()
4949
This test defines one `unittest` (a macro provided by `ArduionUnitTests.h`), called `your_test_name`, which makes some assertions on the target library. The `unittest_main()` is a macro for the `int main()` boilerplate required for unit testing.
5050

5151

52+
### Using `GODMODE`
53+
54+
Complete control of the Arduino environment is available in your unit tests through a construct called `GODMODE()`.
55+
56+
```C++
57+
unittest(example_godmode_stuff)
58+
{
59+
GodmodeState* state = GODMODE(); // get access to the state
60+
state->reset(); // does a full reset of the state.
61+
state->resetClock(); // - you can reset just the clock (to zero)
62+
state->resetPins(); // - or just the pins
63+
state->micros = 1; // manually set the clock such that micros() returns 1
64+
state->digitalPin[4]; // stores the commanded state of digital pin 4
65+
state->digitalPin[4] = HIGH; // digitalRead(4) will now return HIGH
66+
state->analogPin[3]; // stores the commanded state of analog pin 3
67+
state->analogPin[3] = 99; // analogRead(3) will now return 99
68+
}
69+
```
70+
71+
5272
## More Documentation
5373

5474
This software is in alpha. But [SampleProjects/DoSomething](SampleProjects/DoSomething) has a decent writeup and is a good bare-bones example of all the features.

0 commit comments

Comments
 (0)