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 Serial doesn't work in added empty c and h file (Read 821 times)
andi0000085
Newbies
*
Offline


Posts: 1
Joined: Oct 27th, 2019
Serial doesn't work in added empty c and h file
Oct 27th, 2019 at 9:01pm
Print Post  
Hi, I want to split up the functionality in several files. So I added an "empty arduino c and h file" and added a simple Serial.println command in a function. This function I will call in the main.ino file and I always get the error "SerialUSB" undeclared. What do I have to include to get the Serial working?

Thanks

Error: 
Code (C++)
Select All
test.c: In function printTest

variant.h: 204:37: error: 'SerialUSB' undeclared (first use in this function); did you mean 'SerialGSM'?
   #define Serial                      SerialUSB
test.c:9: note  in expansion of macro Serial
   Serial.println("Hello3")
 


  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Serial doesn't work in added empty c and h file
Reply #1 - Oct 28th, 2019 at 11:30am
Print Post  
use .cpp and .h not .c and .h. Ensure you add the #include "Arduino.h" to the code
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint