@@ -34,6 +34,7 @@ ScienceKitCarrier::ScienceKitCarrier(){
3434 inputA=0 ;
3535 inputB=0 ;
3636 timer_inputA = 0 ;
37+ board_resolution = BOARD_RESOLUTION;
3738
3839 apds9960 = new APDS9960 (Wire,INT_APDS9960);
3940 proximity=0 ;
@@ -235,6 +236,9 @@ void ScienceKitCarrier::update(const bool roundrobin){
235236
236237
237238
239+
240+
241+
238242/* *******************************************************************/
239243/* Analog Inputs */
240244/* *******************************************************************/
@@ -249,7 +253,7 @@ void ScienceKitCarrier::updateAnalogInput(const uint8_t input_to_update){
249253 if ((input_to_update==UPDATE_INPUT_A)||(input_to_update==UPDATE_ALL)){
250254
251255 if (!getExternalTemperatureIsConnected ()){
252- inputA=analogRead (inputA_pin);
256+ inputA=analogRead (inputA_pin)>>board_resolution ;
253257 #ifdef ESP32
254258 beginExternalTemperature ();
255259 #endif
@@ -260,7 +264,7 @@ void ScienceKitCarrier::updateAnalogInput(const uint8_t input_to_update){
260264
261265 }
262266 if ((input_to_update==UPDATE_INPUT_B)||(input_to_update==UPDATE_ALL)){
263- inputB=analogRead (inputB_pin);
267+ inputB=analogRead (inputB_pin)>>board_resolution ;
264268 }
265269}
266270
@@ -279,12 +283,14 @@ int ScienceKitCarrier::getInputB(){
279283/* *******************************************************************/
280284/* APDS9960 */
281285/* *******************************************************************/
286+
282287int ScienceKitCarrier::beginAPDS (){
283288 if (!apds9960->begin ()) {
284289 return ERR_BEGIN_APDS;
285290 }
286291 return 0 ;
287292}
293+
288294void ScienceKitCarrier::updateAPDS (){
289295 wire_lock;
290296 if (apds9960->proximityAvailable ()){
@@ -407,8 +413,6 @@ float ScienceKitCarrier::getResistanceMeasureVolts(){
407413 return value;
408414}
409415
410-
411-
412416float ScienceKitCarrier::getResistance (){
413417 return resistance;
414418}
@@ -590,6 +594,7 @@ float ScienceKitCarrier::getMagneticFieldZ(){
590594
591595
592596
597+
593598/* *******************************************************************/
594599/* LEDs: errors and status */
595600/* *******************************************************************/
@@ -680,6 +685,9 @@ void ScienceKitCarrier::freeRTOSStatusLed(void * pvParameters){
680685#endif
681686
682687
688+
689+
690+
683691/* *******************************************************************/
684692/* Function Generator Controller */
685693/* *******************************************************************/
@@ -722,6 +730,8 @@ uint8_t ScienceKitCarrier::getRange2(){
722730
723731
724732
733+
734+
725735/* *******************************************************************/
726736/* Ultrasonic Sensor */
727737/* *******************************************************************/
@@ -802,10 +812,13 @@ void ScienceKitCarrier::freeRTOSUltrasonic(void * pvParameters){
802812}
803813#endif
804814
815+
816+
817+
818+
805819/* *******************************************************************/
806820/* External Temperature Probe */
807821/* *******************************************************************/
808- // WIP
809822
810823int ScienceKitCarrier::beginExternalTemperature (){
811824 new (&ow) OneWireNg_CurrentPlatform (OW_PIN, false );
@@ -854,7 +867,6 @@ void ScienceKitCarrier::updateExternalTemperature(){
854867 }
855868}
856869
857-
858870float ScienceKitCarrier::getExternalTemperature (){
859871 return external_temperature;
860872}
@@ -880,9 +892,13 @@ void ScienceKitCarrier::freeRTOSExternalTemperature(void * pvParameters){
880892#endif
881893
882894
895+
896+
897+
883898/* *******************************************************************/
884899/* Microphone */
885900/* *******************************************************************/
901+
886902#ifdef ARDUINO_NANO_RP2040_CONNECT
887903int ScienceKitCarrier::beginMicrophone (){
888904 PDM.setGain (50 );
@@ -920,6 +936,7 @@ uint ScienceKitCarrier::getMicrophoneRMS(){
920936
921937
922938
939+
923940/* *******************************************************************/
924941/* Threads */
925942/* *******************************************************************/
@@ -976,6 +993,9 @@ void ScienceKitCarrier::startAuxiliaryThreads(const uint8_t auxiliary_threads){
976993}
977994
978995
996+
997+
998+
979999/* **
9801000 * _ _
9811001 * /\ | | (_)
0 commit comments