Skip to content

Commit

Permalink
Properly initializing the DigitalOut buffer. Hopefully addresses #68
Browse files Browse the repository at this point in the history
  • Loading branch information
giuliomoro committed Oct 19, 2020
1 parent 24dc00d commit 2087665
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/plugins/BELAUGens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,9 @@ void DigitalOut_Ctor(DigitalOut* unit) {
(int)ZIN0(2); // method of writing; 1 = writeOnce; 0 = write on change -- cannot change after construction
unit->mDigitalPin = (int)fDigital;
unit->mLastOut = 0;
// initialize first buffer
pinMode(context, 0, unit->mDigitalPin, OUTPUT);
digitalWrite(context, 0, unit->mDigitalPin, unit->mLastOut);

if ((unit->mDigitalPin < 0) || (unit->mDigitalPin >= context->digitalChannels)) {
rt_printf("DigitalOut warning: digital pin must be between %i and %i, it is %i \n", 0, context->digitalChannels,
Expand Down

0 comments on commit 2087665

Please sign in to comment.