Cannot convert 'const bool' Arduino R4

Good morning, I have a problem, I switched from Arduino UNO R3 to Arduino UNO R4 Minima, unfortunately the “DigitalWrite” function and related functions using the same operating scheme do not work now. I have this error:

error: cannot convert ‘const bool’ to ‘PinStatus’ for argument ‘2’ to ‘void digitalWrite(pin_size_t, PinStatus)’
::digitalWrite(constant_input_PORT, val);
^

Error during build: exit status 1

My current knowledge does not allow me to solve the problem on my own. Could you please help me? Could someone change the “DigitalWrite” code?

Please help.

In general, it is helpful to post the part of your code that is generating the issue. If you can create a new patch with only the nodes required to generate the same error, that would help you debug the issue as well as help others see where the problem might be.

That being said, it looks like your problem is with the digital-write node itself, which includes this code:

const bool val = getValue<input_SIG>(ctx);
::digitalWrite(constant_input_PORT, val);

It seems very odd that this commonly used node that hasn’t been changed in a long time would suddenly be a problem just for you… There is some chance that you have over-ridden the default code. See one of many previous posts on this topic: I broke XOD with help from my son

I want to test a single DigitalWrite block. I didn’t touch the original code. It works on R3 with ATmega, on R4 minima it doesn’t work.

#pragma XOD evaluate_on_pin disable
#pragma XOD evaluate_on_pin enable input_UPD

node {
    void evaluate(Context ctx) {
        static_assert(isValidDigitalPort(constant_input_PORT), "must be a valid digital port");

        if (!isInputDirty<input_UPD>(ctx))
            return;

        ::pinMode(constant_input_PORT, OUTPUT);
        const bool val = getValue<input_SIG>(ctx);
        ::digitalWrite(constant_input_PORT, val);
        emitValue<output_DONE>(ctx, 1);
    }
}

I will also write that I have “Arduino R4 Minima” since yesterday, I uploaded my “larger” project and it works flawlessly, I wanted to check other blocks and, to my surprise, I failed on such a basic block as DigitalWrite. Why did I change R3 to R4? Because R4 has 256kb of memory. Other blocks that work similarly to DigitalWrite, e.g. the IRQ signal from the PN532 module, also do not work on R4. Same kind of error.

My dears, any ideas? Should I understand that Arduino R4 Minima is not compatible with XOD? Everything that does not work on R4 works on UNO R3 and NANO - I checked.
It would be a pity, as an electrician, I am closer to connecting function blocks than to writing code.

Looks like R4 came out after last release of XOD, so there is a chance XOD will not work on it, but the compatibility should be handled by ivrtools, which XOD downloads to provide individual board support. There is some chance your download or config of ivrtools is broken or out-of-date. I don’t have an R4 version to test with. I assume nobody else monitoring the forum does either since they have not chimed in to say theirs works or confirm R4 is a problem.

Thank you for your answer. All I can do is wait for an update that will fix the problem.

Helo psaroni / gweimer
i have Arduino UNO R4 Wifi board and when i upload a digitalWrite block on its own i get a fault
identical to psarion
error: cannot convert ‘const bool’ to ‘PinStatus’ for argument ‘2’ to ‘void digitalWrite(pin_size_t, PinStatus)’
::digitalWrite(constant_input_PORT, val);
^

Error during build: exit status 1
The digitalWrite block works fine on my other boards eg UNO R3,maxima, nano

im not much help but at least i have confirmed psaroni,s problem.

looser.

Thank you for your reply. I hope the problem will be solved. There was also a report here (last message)

https://forum.xod.io/t/error-exit-status-1-uart-0-node-uno-r4-minima/6722/2

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.