Arduino nano as Trustmaster warthog slew mod

Welcome
I am currently working on a project that should enable me to improve my Thrustmaster Warthog joystick.
I found a project on instructables.com that I would like to do with Arduino Nano.
Link to the project worthdog mini joystick.
During compilation, unfortunately, I encounter a problem and I would ask for help, possibly directing to a solution.

> #include "Wire.h"     
>  
> void setup() {
>   Wire.begin(0x41);                // join i2c bus with address 0x41
>   Wire.onReceive(receiveEvent);    // I2C events
>   Wire.onRequest(requestEvent);
> }
> 
> volatile byte i2c_reg = 0;  //stores last byte transmitted
> volatile bool flag = 0;     //flag to set after y val sent
> 
> char x_pos = 0;  //stores x and y vals to be sent
> char y_pos = 0;
> 
> void loop() {
>   char temp_x = char(map(analogRead(3), 1023, 0, -128, 127));  //scales analog inputs to correct size
>   char temp_y = char(map(analogRead(4), 0, 1023, -128, 127));
>   if (flag) {
>     noInterrupts();
>     flag = 0;
>     x_pos = temp_x;
>     y_pos = temp_y;
>     interrupts();
>   }
> }
> 
> void requestEvent() {
>   switch (i2c_reg) {
>     case 0x10:
>       Wire.write(x_pos); //x val
>       break;
>     case 0x11:
>       Wire.write(y_pos); //y val
>       flag = 1;
>       break;
>     case 0x0F: //Ctrl 1 regester
>       Wire.write(0b11110001);
>       break;
>   }
> }
> 
> void receiveEvent() {
>   while (Wire.available()) {
>     i2c_reg = Wire.read();
>   }
> }

the error that pops up is:

In function 'void setup ()':*
5:30: warning: invalid conversion from 'void () ()' to 'void () (int)' [-fpermissive]*

Wire.onReceive (receiveEvent); // I2C events*
Wire.h: 76: 10: note: initializing argument 1 of 'void TwoWire :: onReceive (void () (int))'

void onReceive (void () (int));

Thanks in advance for the hints.
Regards Arkadiusz

Where did you see the word "error"?

Uh-oh.

You have the point: its warning :slight_smile:
is it possible to correct the code? Will this warning affect the operation of the program?

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