What pins are the I2C ports directly wired to?

Understanding the language, error messages, etc.

What pins are the I2C ports directly wired to?

Postby Sushi » Fri Nov 07, 2014 3:44 pm

I'm trying to replicate r0d0t's Ghost Detector in which he used the I2C ports as direct inputs. I'm using analogRead(27) and analogRead(28) to gather information from the I2C, but I get a lot of static. That's why I'm unsure I have the proper pins. I used the Gamebuino schematic from the wiki to get the pins 27 and 28. Does anyone know what I'm doing wrong? My code:
Code: Select all
#include <Gamebuino.h>
#include <SPI.h>
Gamebuino gb;
const DAT = 27;
const CLK = 28;
float DATA = 0;

void setup(){
  pinMode(DAT,INPUT);
  pinMode(CLK,INPUT);
  gb.begin();
  gb.titleScreen(F("Ghost Detector"));
}
void loop(){
  if(gb.update()){
    DATA = analogRead(DAT)/2 + analogRead(CLK)/2;
    gb.display.drawRect(0,30,DATA,5);
    if(gb.buttons.pressed(BTN_C)){
      gb.titleScreen(F("Ghost Detector"));
    }
  }
}
User avatar
Sushi
 
Posts: 52
Joined: Tue Oct 07, 2014 12:12 am

Re: What pins are the I2C ports directly wired to?

Postby rodot » Fri Nov 07, 2014 7:01 pm

Did you cut the pull-up jumper to disable it?
User avatar
rodot
Site Admin
 
Posts: 1290
Joined: Mon Nov 19, 2012 11:54 pm
Location: France

Re: What pins are the I2C ports directly wired to?

Postby Sushi » Sat Nov 08, 2014 3:37 am

No, I didn't. Would that mean desoldering? If anything, I can't solder to save myself. XD. Also, does my code look okay?
User avatar
Sushi
 
Posts: 52
Joined: Tue Oct 07, 2014 12:12 am


Return to Programming Questions

Who is online

Users browsing this forum: No registered users and 67 guests