Skip to main content
Arduino

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

"stray '/302' in program error" when compiling

For some weird reason, the following code doesn't compile. I get a "stray '302円' in program" error around volatile unsigned int encoderPos = 0;, and I have no idea what the issue is. I've been trying to figure this out for over 40min, and nothing works. It doesn't make any sense 😭

#include <U8g2lib.h>
#include <SPI.h>
//Pin definitions:
const int control_PWM = A3; //PWM output for the delay 
const int btn_1 = 1; //Button for mode 1
const int btn_2 = 4; //Button for mode 2
const int btn_3 = 5; //Button for mode 3
const int r_A = 2; //Rotary encoder A's data
const int r_B = 3; //Rotary encoder A's data
const int r_SW = 0; //Rotary encoder's button data
const int oled_CLK = 9; //SPI cloack
const int oled_MOSI = 8; //MOSI pin
const int oled_CS = 7; //Chip Select pin
const int oled_DC = 6; //OLED's D/C pin
U8G2_SH1106_128X64_NONAME_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
int mode = 1; //1: RGB, 2: HSL, 3: Distance control
int value_selection = 1; //Actual value selectrion
int value1 = 0; //red in mode 1; tint in mode 2
int value2 = 0; ////green in mode 1; saturation in mode 2
int value3 = 0; //blue in mode 1; luminosity in mode 2
volatile unsigned int encoderPos = 0; // rotary encoder's current position
unsigned int lastReportedPos = 1; // rotary encoder's previous position
static boolean rotating=false; // is the encoder activity status
// interrupter variables
boolean A_set = false; 
boolean B_set = false;
boolean A_change = false;
boolean B_change= false;
void setup() {
}
void loop() {
}

Answer*

Draft saved
Draft discarded
Cancel
1
  • You can probably just copy the code from your post and past it over the original code in the IDE. As I can't detect any weird characters in the text above (I think browser replace NBSPs with regular spaces). Invisible characters can be quite a pain for some compilers. Commented Oct 27, 2016 at 16:12

lang-cpp

AltStyle によって変換されたページ (->オリジナル) /