user70717: I'm trying to connect paj7620 to nodemcu micro-controller. I have implemented the following code and it worked perfect on arduino uno. The problem is that I was made to migrate to nodemcu.
Here is my code:
/*
 * Copyright (c) 2015 seeed technology inc.
 * Website    : www.seeed.cc
 * Author     : Wuruibin
 * Modified Time: June 2015
 * Description: This demo can recognize 15 gestures and output the result. 
 *              You can adjust the reaction time according to the actual circumstance
 *              by modifying "#define GES_REACTION_TIME  500".
 * 
 * The MIT License (MIT)
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
#include <ESP8266WiFi.h>
#include <Wire.h>
#include "paj7620.h"

/* 
Notice: When you want to recognize the Forward/Backward gesture or other continuous gestures, your gestures' reaction time must less than GES_REACTION_TIME(0.8s). 
        You also can adjust the reaction time according to the actual circumstance.
*/
#define GES_REACTION_TIME       800
#define GES_QUIT_TIME           1000

void setup()
{
    uint8_t error = 0;

    Serial.begin(9600);
    Serial.println("\nPAJ7620U2 TEST DEMO: Recognize 15 gestures.");

    error = paj7620Init();          // initialize Paj7620 registers
    if (error) 
    {
        Serial.print("INIT ERROR,CODE:");
        Serial.println(error);
    }
    else
    {
        Serial.println("INIT OK");
    }
    Serial.println("Please input your gestures:");
    Serial.begin(115200);
  Serial.println();

  // Serial.print("Setting soft-AP configuration ... ");
  // Serial.println(WiFi.softAPConfig(local_IP, gateway, subnet) ? "Ready" : "Failed!");

  Serial.print("Setting soft-AP ... ");
  Serial.println(WiFi.softAP("NODEMCU") ? "Ready" : "Failed!");

  Serial.print("Soft-AP IP address = ");
  Serial.println(WiFi.softAPIP());
}

void loop()
{
    uint8_t data = 0, data1 = 0, error; 

    error = paj7620ReadReg(0x43, 1, &data);             // Read Bank_0_Reg_0x43/0x44 for gesture result.
    if (!error) 
    {
        switch (data)                                   // When different gestures be detected, the variable 'data' will be set to different values by paj7620ReadReg(0x43, 1, &data).
        {
            case GES_RIGHT_FLAG:
                delay(GES_REACTION_TIME);
                paj7620ReadReg(0x43, 1, &data);
                if(data == GES_LEFT_FLAG) 
                {
                    Serial.println("Right-Left");
                }
                else if(data == GES_FORWARD_FLAG) 
                {
                    Serial.println("Forward");
                    delay(GES_QUIT_TIME);
                }
                else if(data == GES_BACKWARD_FLAG) 
                {
                    Serial.println("Backward");
                    delay(GES_QUIT_TIME);
                }
                else
                {
                    Serial.println("Right");
                }          
                break;
            case GES_LEFT_FLAG:
                delay(GES_REACTION_TIME);
                paj7620ReadReg(0x43, 1, &data);
                if(data == GES_RIGHT_FLAG) 
                {
                    Serial.println("Left-Right");
                }
                else if(data == GES_FORWARD_FLAG) 
                {
                    Serial.println("Forward");
                    delay(GES_QUIT_TIME);
                }
                else if(data == GES_BACKWARD_FLAG) 
                {
                    Serial.println("Backward");
                    delay(GES_QUIT_TIME);
                }
                else
                {
                    Serial.println("Left");
                }          
                break;
                break;
            case GES_UP_FLAG:
                delay(GES_REACTION_TIME);
                paj7620ReadReg(0x43, 1, &data);
                if(data == GES_DOWN_FLAG) 
                {
                    Serial.println("Up-Down");
                }
                else if(data == GES_FORWARD_FLAG) 
                {
                    Serial.println("Forward");
                    delay(GES_QUIT_TIME);
                }
                else if(data == GES_BACKWARD_FLAG) 
                {
                    Serial.println("Backward");
                    delay(GES_QUIT_TIME);
                }
                else
                {
                    Serial.println("Up");
                }
                break;
            case GES_DOWN_FLAG:
                delay(GES_REACTION_TIME);
                paj7620ReadReg(0x43, 1, &data);
                if(data == GES_UP_FLAG) 
                {
                    Serial.println("Down-Up");
                }
                else if(data == GES_FORWARD_FLAG) 
                {
                    Serial.println("Forward");
                    delay(GES_QUIT_TIME);
                }
                else if(data == GES_BACKWARD_FLAG) 
                {
                    Serial.println("Backward");
                    delay(GES_QUIT_TIME);
                }
                else
                {
                    Serial.println("Down");
                }
                break;
            case GES_FORWARD_FLAG:
                delay(GES_REACTION_TIME);
                paj7620ReadReg(0x43, 1, &data);
                if(data == GES_BACKWARD_FLAG) 
                {
                    Serial.println("Forward-Backward");
                    delay(GES_QUIT_TIME);
                }
                else
                {
                    Serial.println("Forward");
                    delay(GES_QUIT_TIME);
                }
                break;
            case GES_BACKWARD_FLAG:       
                delay(GES_REACTION_TIME);
                paj7620ReadReg(0x43, 1, &data);
                if(data == GES_FORWARD_FLAG) 
                {
                    Serial.println("Backward-Forward");
                    delay(GES_QUIT_TIME);
                }
                else
                {
                    Serial.println("Backward");
                    delay(GES_QUIT_TIME);
                }
                break;
            case GES_CLOCKWISE_FLAG:
                Serial.println("Clockwise");
                break;
            case GES_COUNT_CLOCKWISE_FLAG:
                Serial.println("anti-clockwise");
                break;  
            default:
                paj7620ReadReg(0x44, 1, &data1);
                if (data1 == GES_WAVE_FLAG) 
                {
                    Serial.println("wave");
                }
                break;
        }
    }
    delay(100);
}

------------------------
|paj7620    | nodemcu  |
------------------------
| VCC       | 3.3v     |
------------------------
| GND       | GND      |
------------------------
| SCL       | D1       |
------------------------
| SDA       | D2       |
------------------------

After connecting the ports like the above table, I get the following error when I am trying to upload the code on nodemcu.
Would someone help me how to resolve this error?

Wiring

PS I have also tried I2C Scanner as @timemage mentioned in comments.

PS 2 It works properly when I connect the paj7620 to arduino compiling the above code.

output:


user70717: Special thanks to @timemage for his support. After struggling with the board for more than 6 hours it works properly. I will describe and give more details about how the problem was solved later on.
Arduino Uno has 5 Analog inputs, while there isn't any of them on nodemcu. To connect paj7620 to nodemcu, it is noticable that as @timemage said:

"The A4 and A5 on the UNO are where the ATMega328P's I2C bus signals happen to be. Earlier versions of the Arduino UNO and related boards didn't have dedicated SDA and SCL headers as they do now. On those UNO that have SDA and SCL pins on the upper digital header, they are the same exact signal as those found on A4 and A5."

So the first schema was correct.
As it is implied from the fifth page of this link there isn't any difference among 3.3v inputs on nodemcu. But I have changed wiring like the following image and it works!

#COLOR MAPPING
RED: VCC - 3.3v
BLACK: GND
ORANGE: SCL - D1
GREEN: SDA - D2

I hope it helps, cause there isn't any way to trace the problem. :)

70717: <p>I'm trying to connect paj7620 to nodemcu micro-controller. I have implemented the following code and it worked perfect on arduino uno. The problem is that I was made to migrate to nodemcu.</p>
<p>Here is my code:</p>
<pre><code>/*
 * Copyright (c) 2015 seeed technology inc.
 * Website    : www.seeed.cc
 * Author     : Wuruibin
 * Modified Time: June 2015
 * Description: This demo can recognize 15 gestures and output the result. 
 *              You can adjust the reaction time according to the actual circumstance
 *              by modifying &quot;#define GES_REACTION_TIME  500&quot;.
 * 
 * The MIT License (MIT)
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the &quot;Software&quot;), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
#include &lt;ESP8266WiFi.h&gt;
#include &lt;Wire.h&gt;
#include &quot;paj7620.h&quot;

/* 
Notice: When you want to recognize the Forward/Backward gesture or other continuous gestures, your gestures' reaction time must less than GES_REACTION_TIME(0.8s). 
        You also can adjust the reaction time according to the actual circumstance.
*/
#define GES_REACTION_TIME       800
#define GES_QUIT_TIME           1000

void setup()
{
    uint8_t error = 0;

    Serial.begin(9600);
    Serial.println(&quot;\nPAJ7620U2 TEST DEMO: Recognize 15 gestures.&quot;);

    error = paj7620Init();          // initialize Paj7620 registers
    if (error) 
    {
        Serial.print(&quot;INIT ERROR,CODE:&quot;);
        Serial.println(error);
    }
    else
    {
        Serial.println(&quot;INIT OK&quot;);
    }
    Serial.println(&quot;Please input your gestures:&quot;);
    Serial.begin(115200);
  Serial.println();

  // Serial.print(&quot;Setting soft-AP configuration ... &quot;);
  // Serial.println(WiFi.softAPConfig(local_IP, gateway, subnet) ? &quot;Ready&quot; : &quot;Failed!&quot;);

  Serial.print(&quot;Setting soft-AP ... &quot;);
  Serial.println(WiFi.softAP(&quot;NODEMCU&quot;) ? &quot;Ready&quot; : &quot;Failed!&quot;);

  Serial.print(&quot;Soft-AP IP address = &quot;);
  Serial.println(WiFi.softAPIP());
}

void loop()
{
    uint8_t data = 0, data1 = 0, error; 

    error = paj7620ReadReg(0x43, 1, &amp;data);             // Read Bank_0_Reg_0x43/0x44 for gesture result.
    if (!error) 
    {
        switch (data)                                   // When different gestures be detected, the variable 'data' will be set to different values by paj7620ReadReg(0x43, 1, &amp;data).
        {
            case GES_RIGHT_FLAG:
                delay(GES_REACTION_TIME);
                paj7620ReadReg(0x43, 1, &amp;data);
                if(data == GES_LEFT_FLAG) 
                {
                    Serial.println(&quot;Right-Left&quot;);
                }
                else if(data == GES_FORWARD_FLAG) 
                {
                    Serial.println(&quot;Forward&quot;);
                    delay(GES_QUIT_TIME);
                }
                else if(data == GES_BACKWARD_FLAG) 
                {
                    Serial.println(&quot;Backward&quot;);
                    delay(GES_QUIT_TIME);
                }
                else
                {
                    Serial.println(&quot;Right&quot;);
                }          
                break;
            case GES_LEFT_FLAG:
                delay(GES_REACTION_TIME);
                paj7620ReadReg(0x43, 1, &amp;data);
                if(data == GES_RIGHT_FLAG) 
                {
                    Serial.println(&quot;Left-Right&quot;);
                }
                else if(data == GES_FORWARD_FLAG) 
                {
                    Serial.println(&quot;Forward&quot;);
                    delay(GES_QUIT_TIME);
                }
                else if(data == GES_BACKWARD_FLAG) 
                {
                    Serial.println(&quot;Backward&quot;);
                    delay(GES_QUIT_TIME);
                }
                else
                {
                    Serial.println(&quot;Left&quot;);
                }          
                break;
                break;
            case GES_UP_FLAG:
                delay(GES_REACTION_TIME);
                paj7620ReadReg(0x43, 1, &amp;data);
                if(data == GES_DOWN_FLAG) 
                {
                    Serial.println(&quot;Up-Down&quot;);
                }
                else if(data == GES_FORWARD_FLAG) 
                {
                    Serial.println(&quot;Forward&quot;);
                    delay(GES_QUIT_TIME);
                }
                else if(data == GES_BACKWARD_FLAG) 
                {
                    Serial.println(&quot;Backward&quot;);
                    delay(GES_QUIT_TIME);
                }
                else
                {
                    Serial.println(&quot;Up&quot;);
                }
                break;
            case GES_DOWN_FLAG:
                delay(GES_REACTION_TIME);
                paj7620ReadReg(0x43, 1, &amp;data);
                if(data == GES_UP_FLAG) 
                {
                    Serial.println(&quot;Down-Up&quot;);
                }
                else if(data == GES_FORWARD_FLAG) 
                {
                    Serial.println(&quot;Forward&quot;);
                    delay(GES_QUIT_TIME);
                }
                else if(data == GES_BACKWARD_FLAG) 
                {
                    Serial.println(&quot;Backward&quot;);
                    delay(GES_QUIT_TIME);
                }
                else
                {
                    Serial.println(&quot;Down&quot;);
                }
                break;
            case GES_FORWARD_FLAG:
                delay(GES_REACTION_TIME);
                paj7620ReadReg(0x43, 1, &amp;data);
                if(data == GES_BACKWARD_FLAG) 
                {
                    Serial.println(&quot;Forward-Backward&quot;);
                    delay(GES_QUIT_TIME);
                }
                else
                {
                    Serial.println(&quot;Forward&quot;);
                    delay(GES_QUIT_TIME);
                }
                break;
            case GES_BACKWARD_FLAG:       
                delay(GES_REACTION_TIME);
                paj7620ReadReg(0x43, 1, &amp;data);
                if(data == GES_FORWARD_FLAG) 
                {
                    Serial.println(&quot;Backward-Forward&quot;);
                    delay(GES_QUIT_TIME);
                }
                else
                {
                    Serial.println(&quot;Backward&quot;);
                    delay(GES_QUIT_TIME);
                }
                break;
            case GES_CLOCKWISE_FLAG:
                Serial.println(&quot;Clockwise&quot;);
                break;
            case GES_COUNT_CLOCKWISE_FLAG:
                Serial.println(&quot;anti-clockwise&quot;);
                break;  
            default:
                paj7620ReadReg(0x44, 1, &amp;data1);
                if (data1 == GES_WAVE_FLAG) 
                {
                    Serial.println(&quot;wave&quot;);
                }
                break;
        }
    }
    delay(100);
}
</code></pre>
<pre><code>------------------------
|paj7620    | nodemcu  |
------------------------
| VCC       | 3.3v     |
------------------------
| GND       | GND      |
------------------------
| SCL       | D1       |
------------------------
| SDA       | D2       |
------------------------
</code></pre>
<p>After connecting the ports like the above table, I get the following error when I am trying to upload the code on nodemcu.</p>
<p>Would someone help me how to resolve this error?</p>
<p><a href="https://i.stack.imgur.com/yek2q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yek2q.png" alt="enter image description here" /></a></p>
<p><strong>Wiring</strong>
<a href="https://i.stack.imgur.com/JO9OG.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JO9OG.jpg" alt="enter image description here" /></a></p>
<p><strong>PS</strong> I have also tried <a href="https://playground.arduino.cc/Main/I2cScanner/" rel="nofollow noreferrer">I2C Scanner</a> as @timemage mentioned in comments.</p>
<p><a href="https://i.stack.imgur.com/VmCbG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VmCbG.png" alt="enter image description here" /></a></p>
<p><strong>PS 2</strong> It works properly when I connect the paj7620 to arduino compiling the above code.</p>
<p><a href="https://i.stack.imgur.com/H5Ll3.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/H5Ll3.jpg" alt="enter image description here" /></a></p>
<p><strong>output:</strong>
<a href="https://i.stack.imgur.com/vRN7m.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vRN7m.png" alt="enter image description here" /></a></p>
 70717: <p>Special thanks to @timemage for his support. After struggling with the board for more than 6 hours it works properly. I will describe and give more details about how the problem was solved later on.</p>
<p>Arduino Uno has 5 Analog inputs, while there isn't any of them on nodemcu. To connect paj7620 to nodemcu, it is noticable that as @timemage said:</p>
<blockquote>
<p>&quot;The A4 and A5 on the UNO are where the ATMega328P's I2C bus signals happen to be. Earlier versions of the Arduino UNO and related boards didn't have dedicated SDA and SCL headers as they do now. On those UNO that have SDA and SCL pins on the upper digital header, they are the same exact signal as those found on A4 and A5.&quot;</p>
</blockquote>
<p>So the first schema was correct.</p>
<p>As it is implied from the fifth page of <a href="https://github.com/nodemcu/nodemcu-devkit-v1.0/blob/master/NODEMCU_DEVKIT_V1.0.PDF" rel="nofollow noreferrer">this link</a> there isn't any difference among 3.3v inputs on nodemcu. But I have changed wiring like the following image and it works!</p>
<p><a href="https://i.stack.imgur.com/aJSUU.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aJSUU.jpg" alt="enter image description here" /></a></p>
<pre><code>#COLOR MAPPING
RED: VCC - 3.3v
BLACK: GND
ORANGE: SCL - D1
GREEN: SDA - D2
</code></pre>
<p>I hope it helps, cause there isn't any way to trace the problem. :)</p>
