View unanswered posts | View active topics It is currently Wed Oct 21, 2020 1:16 am

Reply to topic  [ 1 post ] 
Downloading source to robot corrupts firmware? 
Author Message

Joined: Thu Oct 01, 2015 10:42 am
Posts: 1
Post Downloading source to robot corrupts firmware?
Hello all, I'm new to RobotC and robotics in general, but I've done a little bit of programming in the past for fun.
Anyways, I don't like the restrictions for ordinary arrays, so I tried making my own linked list data structure.
The problem is, even when I only make one node, it corrupts the firmware apparently because it makes the program crash and I can only seem to fix it by
re-downloading the firmware in the Robot program. Why is this happening? Is it my code? (I'm not a very good programmer lol)

Anyways, here's the code so far that causes problems.

#pragma config(I2C_Usage, I2C1, i2cSensors)
#pragma config(Sensor, dgtl3,  Output,         sensorSONAR_cm)
#pragma config(Sensor, dgtl12, Rot,            sensorNone)
#pragma config(Sensor, I2C_1,  ,               sensorQuadEncoderOnI2CPort,    , AutoAssign)
#pragma config(Motor,  port2,           Neck,          tmotorVex393_MC29, openLoop, encoderPort, I2C_1)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

// Linked List, contains a series of references to nodes, acts as an array without the size restrictions.

struct node
 int value;

struct node* lastnode;

void appendtolist(int x)
 struct node* newnode;

float Revolutions()
 return SensorValue[I2C_1]/(float)650;

task main()

 struct node* root;


  int dist = SensorValue(Output);
  writeDebugStream("\nDist: %f, Revolutions: %f",dist,Revolutions());

  //start at 0,
  //-1 for left until full revolution
  // +1 for right until full revolution


I know it's the linked list, because when I comment out appendtolist and everything the program works fine.

Thu Oct 01, 2015 10:49 am
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.