Go to Post As engineers we should aspire to create, not destroy. If this is the case, why would we want to create machines with the sole purpose to destroy? - WakeZero [more]
Home
Go Back   Chief Delphi > Technical > Programming
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 02-02-2017, 21:41
darklink2458 darklink2458 is offline
Registered User
FRC #4915 (Spartronics)
Team Role: Programmer
 
Join Date: Feb 2016
Rookie Year: 2015
Location: WA
Posts: 6
darklink2458 is an unknown quantity at this point
Arduino Communication with Roborio

We have an arduino that runs the lights on our teams robot. We were wondering if there is a way to have the arduino react to commands made from the driver station. Thanks for any help you can provide.
Reply With Quote
  #2   Spotlight this post!  
Unread 02-02-2017, 21:47
elijah1111's Avatar
elijah1111 elijah1111 is online now
Registered User
FRC #4601 (Circuit Birds)
Team Role: Programmer
 
Join Date: Jan 2017
Rookie Year: 2015
Location: Ohio
Posts: 15
elijah1111 is an unknown quantity at this point
Re: Arduino Communication with Roborio

what do you mean by the driver station commands? what you could do you could use a pwm line or dio from the roborio to the ardouino and read it there
Reply With Quote
  #3   Spotlight this post!  
Unread 02-02-2017, 21:48
skidad68 skidad68 is offline
Registered User
FRC #2506
Team Role: Mentor
 
Join Date: Feb 2013
Rookie Year: 2013
Location: United States
Posts: 13
skidad68 is an unknown quantity at this point
Re: Arduino Communication with Roborio

You can have the Driver Station talk to the roboRIO, and then have the roboRIO talk to the Arduino using the serial port or I2C.
Reply With Quote
  #4   Spotlight this post!  
Unread 02-02-2017, 21:51
elijah1111's Avatar
elijah1111 elijah1111 is online now
Registered User
FRC #4601 (Circuit Birds)
Team Role: Programmer
 
Join Date: Jan 2017
Rookie Year: 2015
Location: Ohio
Posts: 15
elijah1111 is an unknown quantity at this point
Re: Arduino Communication with Roborio

Quote:
Originally Posted by skidad68 View Post
You can have the Driver Station talk to the roboRIO, and then have the roboRIO talk to the Arduino using the serial port or I2C.
How complicated of lighting are we talking here? Would a simple PWM line or DIO not suffice. Just have the roborio output a PWM wave to the arduino to read then you could have your various lighting settings based on the PWM signals.
Reply With Quote
  #5   Spotlight this post!  
Unread 02-02-2017, 22:13
elijah1111's Avatar
elijah1111 elijah1111 is online now
Registered User
FRC #4601 (Circuit Birds)
Team Role: Programmer
 
Join Date: Jan 2017
Rookie Year: 2015
Location: Ohio
Posts: 15
elijah1111 is an unknown quantity at this point
Re: Arduino Communication with Roborio

I would do something like this on arduino side, you could also have multiple pwm values for diffrent lights if you wanted it to.
Code:
float PWMsignal;//the signal from the roborio
void setup() {
  // put your setup code here, to run once:

PWMsignal=0;//intilizes signal

Serial.begin(9600);//syncs up serial output
}

void loop() {
  // put your main code here, to run repeatedly:
  PWMsignal=analogRead(3);//reads the pwm value for pin 3

  if(PWMsignal=42){//if its whatever pwm value you want turn pin 4 on
    digitalWrite(4,HIGH);
  }
  else{
    digitalWrite(4,LOW);
  }
Serial.println(PWMsignal);//outputs value to serial port
}
Reply With Quote
  #6   Spotlight this post!  
Unread 03-02-2017, 07:37
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: 397
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 Communication with Roborio

Quote:
Originally Posted by elijah1111 View Post
Code:
float PWMsignal;
// ...
if(PWMsignal=42)
// ...
__________________
Creator of SmartDashboard.js, an extensible nodejs/webkit replacement for SmartDashboard


https://ligerbots.org
Reply With Quote
  #7   Spotlight this post!  
Unread 03-02-2017, 11:03
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
no team
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Austin, TX
Posts: 1,127
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: Arduino Communication with Roborio

Quote:
Originally Posted by euhlmann View Post
indeed

Code:
int PWMsignal;
// ...
if (PWMsignal == 42)
// ...
I would say that using that method would be highly susceptible to problems. You're relying on some undefined capacitance on the analog pin of the Arduino, cabling, and RoboRIO's PWM pins. You can use I2C, SPI, UART, or UDP/TCP if you get an Ethernet shield.

Another dead simple way would be to use some DIO as outputs. You can have 2^n modes where n is the number of outputs you use.

From Easy to Hard (my opinion of course):
DIO, UART, TCP/UDP, I2C
__________________
Taking a break from mentoring for a few years. (Is that allowed?!?)

Controls Mentor
@rnazaretian

Previous teams:
Team Fusion, FRC 364
Garnet Squadron, FRC 4901

Last edited by RyanN : 03-02-2017 at 11:08.
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 15:32.

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