TomasL skrev:Har du installerat C32? och konfigurerat IDE'n så den hittar.
Ber om ursäkt, ska vara noggrannare nästa gång.
Okej, jag tog och ominstallerade både MPlab samt har installerat PIC32 verktygen.
Nu verkar det fungera och jag kan skapa projekt. Har fått med en demofil (från kitet) till att börja med men tror att den är utdaterad då när jag sätter in den, sparar den som .C fil och sen "add to project" --> Build all så blir det en Error --> Servo.h: No such file or directory
Hur gör jag för att fortsätta?
Ber om ursäkt för nybörjar svaren, kanske tråkigt men vill gärna börja ngnstans

Här är koden;
/************************************************************************/
/* */
/* SRK_Line */
/* */
/* */
/************************************************************************/
/* Author: Jordan Retz */
/* Copyright 2012, Digilent Inc. */
/************************************************************************/
/* Module Description: */
/* */
/* This module implements a simple demo application that shows how to */
/* program the RDK Line - Servo. */
/* */
/* Functionality: */
/* */
/* The application uses the PmodLS1, four IR proximity sensors, and two */
/* servo motors. Based on the outputs of the four sensors attached to */
/* the Pmod, the robot will alter it's direction to stay on a line. */
/* The robot will work best if the line is black electric tape on a */
/* white surface. */
/* */
/* The sensors are referred to as Far Right (FRS), Mid Right (MRS), Mid */
/* Left (MLS), and Far Left (FLS). These should be connected to S1, S2, */
/* S3, S4, respectively, on the PmodLS1. Left and right are determined */
/* looking down on robot with sensor, bracket forward. */
/* */
/* */
/* Instruction FRS MRS MLS FLS Function */
/* 0 0 0 0 0 Stop */
/* 1 0 0 0 1 Turn Right */
/* 2 0 0 1 0 Continue */
/* 3 0 0 1 1 Turn Right */
/* 4 0 1 0 0 Continue */
/* 5 0 1 0 1 Turn Right */
/* 6 0 1 1 0 Continue */
/* 7 0 1 1 1 Turn Right */
/* 8 1 0 0 0 Turn Left */
/* 9 1 0 0 1 Continue */
/* 10 1 0 1 0 Turn Left */
/* 11 1 0 1 1 Turn Right */
/* 12 1 1 0 0 Turn Left */
/* 13 1 1 0 1 Turn Left */
/* 14 1 1 1 0 Turn Left */
/* 15 1 1 1 1 Move Foward */
/* */
/* Pressing BTN2 on the PmodBTN will Start or Stop the robot. The */
/* PmodBTN must be connected to the top row of JD. The PmodCON3 must */
/* be connected to the bottom row of header JC. The PmodLS1 must be */
/* connected to the bottom row of JB. Only BTN2 is a valid input. */
/* */
/* Programming: */
/* */
/* Make sure that the MX3cK is plugged into the computer via USB cable, */
/* and that the board is powered. */
/* */
/* From the toolbar above, select "Tools->Board->MX3cK". From the Start */
/* menu, navitgate to "Start->Control Panel->Hardware and Sound->Device */
/* Manager". Select "Ports", and take note of what COM port (COMx) is */
/* labeled "USB Serial Port". If you are unsure, unplug the MX3cK from */
/* the computer and watch which COM port disappears, and then */
/* reappears, when you plug the MX3cK back into the computer. */
/* From the toolbar above, select "Tools->Serial Port" and then the COM */
/* port that you just found. Apply power to the MX3cK and click on the */
/* "Upload" button above. */
/* */
/************************************************************************/
/* Revision History: */
/* */
/* 6/21/2012 (JordanR): created */
/* 12/17/2012 (MichaelK): Name Change
/* */
/************************************************************************/
/* ------------------------------------------------------------ */
/* Include File Definitions */
/* ------------------------------------------------------------ */
#include <plib.h>
#include <Servo.h>
/* ------------------------------------------------------------ */
/* Local Type Definitions */
/* ------------------------------------------------------------ */
/* These definitions are valid if the PmodCON3 is connected to the
** bottom row of header JC
*/
#define pinServoLeft 23
#define pinServoRight 22
/* These definitions are valid if the PmodBTN is connected to the
** top row of header JD
*/
#define pinBTN0 24
#define pinBTN1 25
#define pinBTN2 26
#define pinBTN3 27
/* These definitions are valid if the PmodLS1 is connected to the
** bottom row of header JB
*/
#define pinFarRight 12
#define pinMidRight 13
#define pinMidLeft 14
#define pinFarLeft 15
/* ------------------------------------------------------------ */
/* Global Variables */
/* ------------------------------------------------------------ */
/*Define Servos*/
Servo left;
Servo right;
byte bInstruction;
byte bPrevInstruction;
bool fRobotStartStop;
/* ------------------------------------------------------------ */
/* Forward Declarations */
/* ------------------------------------------------------------ */
void CheckSensors();
void StopRobot();
void Forward();
void TurnRight();
void TurnLeft();
void RobotStartStop();
/* ------------------------------------------------------------ */
/* Procedure Definitions */
/* ------------------------------------------------------------ */
/*** void setup()
**
** Parameters:
** none
**
** Return Value:
** none
**
** Errors:
** none
**
** Description:
** Initialize the system.
*/
void setup() {
/*Setup Input/Output on Pins
*/
pinMode(pinServoLeft, OUTPUT);
pinMode(pinServoRight, OUTPUT);
pinMode(pinBTN0, INPUT);
pinMode(pinBTN1, INPUT);
pinMode(pinBTN2, INPUT);
pinMode(pinBTN3, INPUT);
pinMode(pinFarRight, INPUT);
pinMode(pinMidRight, INPUT);
pinMode(pinMidLeft, INPUT);
pinMode(pinFarLeft, INPUT);
/*Set Robot default state to STOPPED
*/
fRobotStartStop = false;
/*Attach External Interrupt EXT_INT3
*/
attachInterrupt(EXT_INT3, ISRRobotStartStop, RISING);
}
/* ------------------------------------------------------------ */
/*** void loop();
**
** Parameters:
** none
**
** Return Value:
** none
**
** Errors:
** none
**
** Description:
** Main application loop.
*/
void loop()
{
CheckSensors();
/* Robot Stop if all Sensors are off OR if fRobotStartStop == false
*/
if(bInstruction == 0 || fRobotStartStop == false) {
StopRobot();
}
/* Robot Start if at least one Sensor is on AND if fRobotStartStop == true
*/
else if(fRobotStartStop == true) {
if(bInstruction == 3 || bInstruction == 7 || bInstruction == 11 || bInstruction == 1 || bInstruction == 5){
TurnRight();
}
else if(bInstruction == 12 || bInstruction == 13 || bInstruction == 14 || bInstruction == 8 || bInstruction == 10) {
TurnLeft();
}
else {
Forward();
}
}
}
/* ------------------------------------------------------------ */
/*** byte CheckSensors();
**
** Parameters:
** none
**
** Return Value:
** none
**
** Errors:
** none
**
** Description:
** Returns the state of the sensors. Must be connected to JA
*/
void CheckSensors() {
byte bFRS = digitalRead(pinFarRight)*(0x8);
byte bMRS = digitalRead(pinMidRight)*(0x4);
byte bMLS = digitalRead(pinMidLeft)*(0x2);
byte bFLS = digitalRead(pinFarLeft)*(0x1);
bInstruction = (bFRS | bMRS | bMLS | bFLS);
}
/* ------------------------------------------------------------ */
/*** void StopRobot();
**
** Parameters:
** none
**
** Return Value:
** none
**
** Errors:
** none
**
** Description:
** Stops robot by finding Servo position and reducing or increasing to 90.
** Then detaches pins.
*/
void StopRobot() {
left.write(90);
right.write(90);
left.detach();
right.detach();
}
/* ------------------------------------------------------------ */
/*** void Forward();
**
** Parameters:
** none
**
** Return Value:
** none
**
** Errors:
** none
**
** Description:
** Moves robot forward
*/
void Forward() {
left.attach(pinServoLeft);
right.attach(pinServoRight);
left.write(107);
right.write(73);
}
/* ------------------------------------------------------------ */
/*** void turnRight();
**
** Parameters:
** none
**
** Return Value:
** none
**
** Errors:
** none
**
** Description:
** Turns robot right
*/
void TurnRight() {
left.attach(pinServoLeft);
right.attach(pinServoRight);
left.write(107);
right.write(107);
}
/* ------------------------------------------------------------ */
/*** void turnLeft();
**
** Parameters:
** none
**
** Return Value:
** none
**
** Errors:
** none
**
** Description:
** Turns robot left
*/
void TurnLeft() {
left.attach(pinServoLeft);
right.attach(pinServoRight);
left.write(73);
right.write(73);
}
/* ------------------------------------------------------------ */
/*** void ISRRobotStartStop();
**
** Parameters:
** none
**
** Return Value:
** none
**
** Errors:
** none
**
** Description:
** External Interrupt Service Routine. When button is pressed,
** checks the state of the robot (moving/stopped) and toggles it.
** Robot will then move forward or stop accordingly.
*/
void ISRRobotStartStop() {
/* This line of code toggles the value of fRobotStartStop
*/
fRobotStartStop = !fRobotStartStop;
}