Hi guys,
I am looking for a 3 digit, 7segment, LED display.
the only one I found is from Cesar, in 2018, but not available anymore.
Anyone ?
Hi guys,
I am looking for a 3 digit, 7segment, LED display.
the only one I found is from Cesar, in 2018, but not available anymore.
Anyone ?
In principle, although this is not entirely true, you can copy the code from there and create the same patch.
Not sure I am following, where did you get this sketch ?
also, it look like it is for a single digit, correct ?
I have this sketch, which it work fine, but I want use XOD.
Hello. create a patch and add a not-implemented-in-xod there and then add this code:
#pragma XOD require “https://github.com/sigvaldm/SevenSeg”
// Include C++ library:
{{#global}}
#include <SevenSeg.h>
{{/global}}
struct State {
};
{{ GENERATED_CODE }}
void evaluate(Context ctx) {
if (!isInputDirty<input_UPD>(ctx))
return;
//auto inValue = getValue<input_IN>(ctx);
//emitValue<output_OUT>(ctx, inValue);
SevenSeg disp (10,6,4,2,1,9,5);
const int numOfDigits = 3;
int digitPins [numOfDigits] = {11, 8, 7};
int timer = 999;
int flag;
int AmmoCount;
int AmmoMax;
int Threshold;
int LEDvar;
if (isSettingUp()){ //void setup()
// put your setup code here, to run once:
::pinMode (A0, INPUT);
Threshold = 500;
AmmoMax = 999;
AmmoCount = AmmoMax;
disp.setDigitPins ( numOfDigits, digitPins );
disp.setRefreshRate(150);
}
// put your main code here, to run repeatedly:
disp.write(AmmoCount);
LEDvar = ::analogRead(A0);
if (LEDvar > Threshold){
AmmoCount = AmmoCount - 1;
LEDvar = 0;
}
}
Does not give errors, but I do not have a sensor, so I cannot tell if the program is working. Also I have not added the input output parameters, but if you are good with xod, I do not think that this will cause you problems. The only thing I added to the patch is the input pulse. Called the UPD. It should be on a loop.