The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled Java Code
Posted by: Rob | November 17, 2010 @ 12:19am
Java Code
[
Download
]
#pragma config(ProgramType, StandaloneWiFi) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*// /************************************************************************* Robs Robot Configuration Description: This program gives user full control over all four wheels of the robot. Configuration: This program is written to work with a modified Squarebot model. - Motors in order Clockwise from battery. (1 - 4) Additional Notes: - Robot uses perpendicular motions to move in all directions. - Power levels that can be assigned to a motor port range from -127 (full reverse) to 127 (full forward). *************************************************************************/ int rotateHelper; task main() { while(abs(vexRT[Ch2]) > abs(vexRT[Ch1])) //abs = absolute value { // When right Joystick is Up or Down // Robot goes Forward or Backward while(abs(vexRT[Ch2]) < 87) { // If speed is low, increase speeds to rotate. motor[port1] = -vexRT[Ch2] - rotateHelper; motor[port2] = vexRT[Ch2] + rotateHelper; motor[port3] = vexRT[Ch2] - rotateHelper; motor[port4] = -vexRT[Ch2] + rotateHelper; } while(abs(vexRT[Ch2]) > 87) { // If speed is high, decrease speeds to rotate. motor[port1] = -87 - rotateHelper; motor[port2] = 87 + rotateHelper; motor[port3] = 87 - rotateHelper; motor[port4] = -87 + rotateHelper; } } while(abs(vexRT[Ch2]) < abs(vexRT[Ch1])) // abs = absolute value { // When right Joystick is Right or Left // Robot goes Right or Left while(abs(vexRT[Ch1]) < 87) { // If speed is low, increase speeds to rotate. motor[port1] = vexRT[Ch1] - rotateHelper; motor[port2] = vexRT[Ch1] + rotateHelper; motor[port3] = -vexRT[Ch1] - rotateHelper; motor[port4] = -vexRT[Ch1] + rotateHelper; } while(abs(vexRT[Ch1]) > 87) { // If speed is high, decrease speeds to rotate. motor[port1] = 87 - rotateHelper; motor[port2] = 87 + rotateHelper; motor[port3] = -87 - rotateHelper; motor[port4] = -87 + rotateHelper; } } while(vexRT[Ch6] == 127) { // If right backbutton up is pressed, set rotateHelper to 40. rotateHelper = 40; } while(vexRT[Ch5] == 127) { // If left backbutton up is pressed, set rotateHelper to -40. rotateHelper = -40; } while(vexRT[Ch6] == 0 && vexRT[Ch5] == 0) { // If backbuttons are not pressed, set rotateHelper to 0. rotateHelper = 0; } }//end main
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.58 / 8
26 Votes
http://codebin.yi.org/955
page generated in 0.00 seconds