Digital output question

Arduino Nano digital output D4(Pin7). I can't get the output to turn on.

I am powering with an external 5 vdc power supply.

Code Below:

// setup code

Serial.begin (9600); /* Serial.print ("Divisor: "); Serial.print (Divisor); Serial.print (" NextOutput Pulse: "); Serial.print (NextOutputPulse); Serial.println (" interrupts enabled!"); */ pinMode(EIn, INPUT); pinMode(EOut, OUTPUT); pinMode(8, OUTPUT); pinMode(9, OUTPUT); pinMode(10, OUTPUT); pinMode(11, OUTPUT); pinMode(12, OUTPUT); //attachInterrupt(ExtInterruptNumber, PulseGenerator, RISING); // interrupt on rising edge of signal //interrupts();

}

void PulseGenerator() { // ISR

++PulseCount;

// check to see if it is time to ouput a pulse

if (PulseCount == ((int)((float)(NextOutputPulse+0.5)))) { // Reset the pulse counters to zero to limit the maximize number value // to that of the input frequency. This will prevent the counter from getting // larger than the allowable max integer value

if ((int)NextOutputPulse >= InputFrequency) { PulseCount = 0; NextOutputPulse = 0; }

SendOutputPulse(); NextOutputPulse += Divisor;

} }

Please read this:- How to use this forum Because your post is breaking the rules about posting code.

digital output D4

I can't see that pin being set as an output.

You should post ALL your code as well as posting it correctly.

Pin 7 is EOut , I forgot to post my variables

const int InputFrequency = 5000; const int OutputFrequency = 1024;

volatile int PulseCount = 0; volatile float Divisor = (((float)InputFrequency) / ((float)OutputFrequency)); volatile float NextOutputPulse = Divisor; volatile boolean TriggerPulse = true;

const int ExtInterruptNumber = 0; // external interrupt number for D2 input - signal from encoder to Nano const int EIn = 5; // D2 is encoder input: pin #5 const int EOut = 7; // D4 is reduced encoder ouput: pin #7

A full sketch is posted - only containing the parts of interest. The original output of interest is D4 (pin 7) but code was added to try D5 (pin 8) thru D9 (pin 12). I don’t see the signal change at all on the scope.

DmiGenerator.ino (1.53 KB)

What part of:-

Because your post is breaking the rules about posting code.

Are you having trouble with. By not complying with the rules here you are being disrespectful.

but code was added to try D5 (pin 8) thru D9 (pin 12).

Cool smiley? That is why you have to use code tags.

Sorry about the smiley - obviously a missed typo and not a code reference. My apologies for not complying with the rules. I guess I don't understand them as I have no idea what you're talking about.

There is no intent by ME to be disrespectful. I uploaded the sketch, I didn't paste more code in to the response - I thought that was one of the options in the rules specified.

By the way, I figured out the problem. The pin number for pinMode() refers to the logical pin DIO number not the actual Arduino board pin number. Output D4 should be referenced as pin 4 in pinmode() not pin 7 of the Arduino board.

The smilie was not a typo. It was the forum software mangling your code. That is why we ask everyone to post code using the </> icon. The link tells you all this, why did you not read it?