S2P error

stevesmythe

Senior Member
I am using a DE-ACCM2G2 2-axis accelerometer (y-axis) connected via pin C.0 of the CHI035a board (Picaxe 18M2+). I have written a Scratch program using the correct S2P template and it works fine in connected mode.

When I try and download the program for "remote run mode", I get this error message:

"Cannot have multiple sensor types on pin C.0 ] during Picaxe.setupSensor"

I only have one sensor connected, so what does this error message mean?
 

inglewoodpete

Senior Member
Can you provide a link to the data sheet for the accelerometer so forum members can get an idea of the interface?

I see that the CHI035a has a resistor, R8 10kohms, between C.0 and 0v. Is this required by your circuit or have you removed it?
 
Last edited:

hippy

Technical Support
Staff member
"Cannot have multiple sensor types on pin C.0 ] during Picaxe.setupSensor"

I only have one sensor connected, so what does this error message mean?
It means S2P thinks you have two sensors on C.0 when creating the PICAXE program. If you can post your Scratch program - the saved .sb2 file - we can take a look at that and analyse what the issue may be.

Knowing which version of Scratch (top left) and which version of S2P (bottom right) you are using will also help.
 

hippy

Technical Support
Staff member
Thanks.

My guess is that, when S2P is processing the Scratch code for conversion, it sees a "Wait Until (Sensor C.0)" before it sees the "Setup Sensor [C.0] As [analogue]". And has presumed from the first that C.0 is a digital input so, when it encounters the actual "setup sensor", being digital and analogue is a conflict. Change to "Setup Sensor [C.0] As [switch]" and it removes that conflict report.

We will need to investigate further.
 

stevesmythe

Senior Member
In what order does S2P parse the different Scratch events? I have just managed to get the code to work by removing and rearranging the blocks. However, I have some more code to add, and I'm worried that I'll encounter the same problem. Can the user influence the order in which things are parsed, or should S2P be doing that?

BTW The project is a school project I am doing with my son to build a bascule bridge using Lego (he's doing the building and programming - I'm just the wiring man) . It uses Lego Power Functions motors and Lego lights but also non-Lego traffic lights and accelerometer (and a Snap Circuits push button for good measure!). Each side of the bridge has its own accelerometer so that differences in motor power don't matter, since there's no PWM in S2P.
 
Last edited:

hippy

Technical Support
Staff member
Scratch throws everything into the saved .sb2 file randomly and S2P reads that file sequentially because it is the only way to do that.

I believe S2P should be making multiple reads of the file so it can extract the "When I click the Green Flag" code first but it may be that this is not happening or the "setup sensor" is not being processed at that time. The later is my hunch.

Moving things around would have been my suggestion but my first attempt to do that failed to succeed. Adding "Setup Sensor [C.0] As [analogue]" to each "When I receive" routine in which C.0 is read as analogue may also fix the issue. Duplicate setting as the same type it was should not generate any error.
 

stevesmythe

Senior Member
Thanks Hippy. I think your workaround should fix it, but would be good if RevEd could get to the bottom of the issue for future users.

Ironically, I think the problem first arose when my son used the "clean up" function to rearrange the blocks. We had already tested "remote run" and it was working prior to this.
 
Top