Go to Post I am not short, I am just conveniently packaged. - kio_chan176 [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 21-01-2017, 23:56
avayner avayner is offline
Registered User
FRC #3501
 
Join Date: Jan 2017
Location: Sunnyvale, CA
Posts: 4
avayner is an unknown quantity at this point
Re: Arduino & Roborio cant find each other I2C Issues

We've done exactly that, but for some reason onRequest was not being triggered... Any ideas how to troubleshoot this?
Reply With Quote
  #2   Spotlight this post!  
Unread 22-01-2017, 00:47
euhlmann's Avatar
euhlmann euhlmann is offline
CTO, Programmer
AKA: Erik Uhlmann
FRC #2877 (LigerBots)
Team Role: Leadership
 
Join Date: Dec 2015
Rookie Year: 2015
Location: United States
Posts: 398
euhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud of
Re: Arduino & Roborio cant find each other I2C Issues

Quote:
Originally Posted by avayner View Post
We've done exactly that, but for some reason onRequest was not being triggered... Any ideas how to troubleshoot this?
Could you post the code you're using (roborio and arduino)?
__________________
Creator of SmartDashboard.js, an extensible nodejs/webkit replacement for SmartDashboard


https://ligerbots.org
Reply With Quote
  #3   Spotlight this post!  
Unread 22-01-2017, 01:47
zDrakon zDrakon is offline
Registered User
FRC #3501
 
Join Date: Feb 2015
Location: Sunnyvale
Posts: 12
zDrakon is an unknown quantity at this point
Re: Arduino & Roborio cant find each other I2C Issues

Roborio code: http://pastebin.com/TiFcYq6L

Arduino: http://pastebin.com/TDPk9W5i

Do keep in mind we did try using onREquest for arduino and set it up as a slave prior but for some reason it didnt work. My team is confused, even the mentor is having trouble explaining what's happening.
Reply With Quote
  #4   Spotlight this post!  
Unread 22-01-2017, 15:55
euhlmann's Avatar
euhlmann euhlmann is offline
CTO, Programmer
AKA: Erik Uhlmann
FRC #2877 (LigerBots)
Team Role: Leadership
 
Join Date: Dec 2015
Rookie Year: 2015
Location: United States
Posts: 398
euhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud of
Re: Arduino & Roborio cant find each other I2C Issues

I see. Try this

roboRIO:
Code:
static I2C arduino = new I2C(Port.kOnboard, 42);

@Override
public void teleopPeriodic() {
    byte[] sendData = "sample text".getBytes();
    byte[] receiveData = new byte[sendData.length];
    boolean failed = arduino.transaction(sendData, sendData.length, receiveData, receiveData.length);
    if(!failed) {
        System.out.println("Got data: " + new String(receiveData, 0, receiveData.length);
    }
}
Arduino:
Code:
#include <Wire.h>

void setup() {
  Wire.begin(42);
  Wire.onRequest(requestEvent);
  Serial.begin(9600);
}

void loop() {
  delay(100);
}

// send back the same data as we receive
void requestEvent() {
  Serial.println("Got request:");
  while (Wire.available()) {
    char c = Wire.read();
    Serial.print(c);
    Wire.write(c);
  }
}
__________________
Creator of SmartDashboard.js, an extensible nodejs/webkit replacement for SmartDashboard


https://ligerbots.org
Reply With Quote
  #5   Spotlight this post!  
Unread 27-01-2017, 22:52
Harp Harp is offline
Registered User
FRC #3501
 
Join Date: Jan 2017
Location: Sunnyvale
Posts: 1
Harp is an unknown quantity at this point
Re: Arduino & Roborio cant find each other I2C Issues

The Arduino didn't read anything from the roborio using this code. We've since switched to using a raspberry pi
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 21:48.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi