Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic VS2022 blinking buildin led (Read 869 times)
BeagleBot
Junior Member
**
Offline


Posts: 19
Location: Netherlands
Joined: Jul 8th, 2015
VS2022 blinking buildin led
Mar 3rd, 2023 at 4:21pm
Print Post  
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));

this will give an green rimple line by !digitalRead(LED_BUILTIN));
and I have an message that I must use a "~" and not an "!"
dut the ~ is not working
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12137
Location: United Kingdom
Joined: Apr 10th, 2010
Re: VS2022 blinking buildin led
Reply #1 - Mar 3rd, 2023 at 4:31pm
Print Post  
I suspect that is just intellisense a bit confused and that the ! will build okay? The older arduino avr cores were happy with a bool type comparison but other cores are not.

The issue here is that, for some boards, the digitalRead() does not return a true or false bool, therefore ! is technically wrong.

If you follow the guide in yellow above we will see what core you are using, then we can see how the digitalread() has been defined. It might be happier with != 0


« Last Edit: Mar 3rd, 2023 at 4:34pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint