#pragma config(Sensor, S4, SonarSensor, sensorSONAR) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*// /* Workshop 3: Log Data 5-2-1 Simple Save Sonar Data To Datalog Ron Kessler Created 8/16/2018 updated: 8/16/2018 PURPOSE: Shows how to store 20 SonarSensor readings to a file on the NXT. It also shows how to observe the readings in real time using the Debug Stream Window. */ task main() { //---lets collect 20 readings for(int x = 0; x<20; x++) { AddToDatalog(x, SensorValue[SonarSensor]); //read and save reading writeDebugStreamLine("%i",SensorValue[SonarSensor]);//show in the debug window wait1Msec(1000); } //---after grabbing the data, save to a file. The file is called DATA0001.rdt // the next file is called DATA0002.rdt and so forth. SaveNxtDatalog(); }