/************************************************************************//* *//* Program Name: PSP-Nx-demo.c *//* =========================== *//* *//* Copyright (c) 2008 by mindsensors.com *//* Email: info (<at>) mindsensors (<dot>) com *//* *//* This program is free software. You can redistribute it and/or modify *//* it under the terms of the GNU General Public License as published by *//* the Free Software Foundation; version 3 of the License. *//* Read the license at: http://www.gnu.org/licenses/gpl.txt *//* *//************************************************************************/

// // Note: program cannot be terminated if we hijack the 'exit' button. So there has to be an escape sequence // that will return buttons to system control! We'll use a triple click // nNxtExitClicks = 3; // Triple clicking EXIT button will terminate program // nI2CBytesReady[SensorPort] = 0;

You can't really use a built-in driver and a custom driver on the same port, it often causes problems. I would advise you to connect the PSP-Nx to Port S2 and configure it as sensorI2CCustom9V (unless it's not a 9V sensor).

that helps I now have the button recognized. so does the value of the button equal 1 when unpressed and 0 when pressed? if so how can I reverse that? thanks

Sun Jan 01, 2012 3:09 pm

david fort

Rookie

Joined: Sun Nov 16, 2008 3:07 pmPosts: 45

Re: Edit postReport this postReply with quotePSP-Nx-v3 how d

mightor wrote:

You can't really use a built-in driver and a custom driver on the same port, it often causes problems. I would advise you to connect the PSP-Nx to Port S2 and configure it as sensorI2CCustom9V (unless it's not a 9V sensor).

- Xander

Hey Xander,

Followup on your advice. Do you mean that the program should not have:

#pragma config(Sensor, S1, , sensorI2CMuxController)

Our FTC team 1001 has found that line to cause the Hitechnic motor and servo controllers we have attached to S1 to not work and we didn't know what that line means nor where it comes from.

I apologize if I'm suffering from paranoia, but we really think it keeps "magically" reappearing. i.e. we delete it, then it comes back (usually at really bad times).

This file has had a lot of kids typing things in it over the last few months, and maybe they did something goofy at some stage, but imho, this sensorI2CMuxController thing has a mysteriously zombie like quality.

Would you be so kind to clarify if you mean the second line of S1 pragmas should be whacked and shine any light you can on whether the motor and sensor setup gets "saved" anywhere other than in the #pragmas of the .c file?

// // Note: program cannot be terminated if we hijack the 'exit' button. So there has to be an escape sequence // that will return buttons to system control! We'll use a triple click // nNxtExitClicks = 3; // Triple clicking EXIT button will terminate program // nI2CBytesReady[PSPNX] = 0;

Use the motor and sensor configuration tool to set your sensor types, don't mix doing it with code and doing it with this tool. It will only lead to a giant mess. The PSPNX is now configured to be connected to S2. Change the setup with the utility to make it work with another port. Also consider giving port names sensible names, like PSPNX instead of "SensorPort". I know this is straight from the Mindsensors example, but they're only really good for showing you how to do something quickly.

Assuming that the root of our problems came from deleting #pragmas in the text editor instead of using the Motor & Sensor setup dialog, Is there a way to get them back in synch - for example, are the contents of the Motor and Sensor setup dialog stored somewhere that we can go clean up so they match the #pragmas again?

Assuming that the root of our problems came from deleting #pragmas in the text editor instead of using the Motor & Sensor setup dialog, Is there a way to get them back in synch - for example, are the contents of the Motor and Sensor setup dialog stored somewhere that we can go clean up so they match the #pragmas again?

Dave,

Could this issue -> viewtopic.php?f=1&t=4176 be inter-related? I recall us seeing something like you have described once or twice with an extra line in the pragmas showing up but haven't seen it lately and haven't tried to recreate it.

Our own experience with this stopping being a problem may have coincided with going to 4 controllers which might leave no room for a spurious entry to hang in memory. A thought, perhaps when the dialog reads the pragmas, it doesn't clean up memory for storing pragmas that it doesn't read or for getting ready to write pragmas that aren't currently in the UI. Could it be leaving something in memory if you're not exiting and reloading ROBOTC.

You might want to try a mix of deleting pragmas, saving, closing the ROBOTC environment, and then re-opening and re-adding the pragmas.

Maybe it is a simple matter that if you have one of these extra pragmas, the gui doesn't remove it.

It is possible the kids used the Sensor Tab to set up something and messed it up, conflicting with the Motor and Servo setup from the Tetrix tab, but in my experience (just tested with 3.05) 'OK' on the Motor and Sensor setup rewrites the pragmas and removes the extra one.

In any case, I guess I've hijacked this thread long enough. I'll just delete the line and check for its presence regularly.

Who is online

Users browsing this forum: No registered users and 1 guest

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