Creating a string to be used in a digital output statement

For general Flowcode discussion that does not belong in the other sections.
Post Reply
Billduck1302
Posts: 35
http://meble-kuchenne.info.pl
Joined: Fri Dec 06, 2024 4:41 pm
Has thanked: 2 times
Been thanked: 1 time

Creating a string to be used in a digital output statement

Post by Billduck1302 »

With a Arduino Mega, I want to send a "1" to digital output, say D4.
The "D" will be static. But the port number needs to change.

For example I will have a loop where I increase the integer value of PIN,and send 0 or 1 in a digital write.

In the following statement, for a digital output, the variable "PIN" is an integer.

DigitalOutput = STRING ('D' + PIN) FC is ok with the ststement, but it prints "69"

Any help is paareciated.

mnfisher
Valued Contributor
Posts: 1882
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 154 times
Been thanked: 887 times

Re: Creating a string to be used in a digital output statement

Post by mnfisher »

The easiest way to do this is with a little C.

For example for port d (assuming the pin is set as an output)

PORTD |= (1 << FCL_PIN);

Will turn on 'pin' without affecting other pins in port d

Martin

Post Reply