Error connecting to AWS [solved]

  1. My goal is turn on relay according to the ds18b20 sensor temperature readings.

  2. When I use ‘api_gpio’ and ‘api_arduino_dallas_temp.js’ in my code, my ESP8266 is restarted.

init.js

    load('api_timer.js');
    load('api_arduino_onewire.js');
    load('api_arduino_dallas_temp.js');
    load('api_aws.js');
    load('api_events.js');
    load('api_mqtt.js');
    load('api_timer.js');
    load('api_sys.js');
    load('api_config.js');

    load('api_gpio.js'); // <==== 

    let pin = 4;

    let ow = OneWire.create(pin);

    let dt = DallasTemperature.create(ow);

    dt.begin();

    let n = 0;

    let sens = [];

    let topic = 'metricas/' + Cfg.get('device.id') + '/GPIO4';


    if (n === 0) {
    	n = dt.getDeviceCount();
    	print('Sensors found:', n);

    	for (let i = 0; i < n; i++) {
    		sens[i] = '01234567';
    		if (dt.getAddress(sens[i], i) === 1) {
    			print('Sensor#', i, 'Address:', dt.toHexStr(sens[i]));
    		}
    	}
    }

    Timer.set(10000, Timer.REPEAT, function () {

    	if (AWS.isConnected() || (MQTT.isConnected() && sendMQTT)) {

    		dt.requestTemperatures();

    		  for (let i = 0; i < n; i++) {
            let json = {
    				time: Timer.now(),
    				temp: dt.getTempC(sens[i]),
    			};

    			let mensagem = JSON.stringify(json);

    			MQTT.pub(topic, mensagem, 0);
    		}
    	}
    }, null);

mos.yml

author: mongoose-os 
description: A JS-enabled demo Mongoose OS firmware
version: 1.0

libs_version: ${mos.version}
modules_version: ${mos.version}
mongoose_os_version: ${mos.version}

sources:
  - src
filesystem:
  - fs
libs:
 
  - origin: https://github.com/mongoose-os-libs/boards
  - origin: https://github.com/mongoose-os-libs/ca-bundle
  - origin: https://github.com/mongoose-os-libs/i2c
  - origin: https://github.com/mongoose-os-libs/rpc-service-config
  - origin: https://github.com/mongoose-os-libs/rpc-service-fs
  - origin: https://github.com/mongoose-os-libs/rpc-uart
  - origin: https://github.com/mongoose-os-libs/spi
  - origin: https://github.com/mongoose-os-libs/arduino-dallas-temperature
  - origin: https://github.com/mongoose-os-libs/mjs
  - origin: https://github.com/mongoose-os-libs/js-demo-bundle
  
tags:
  - js
  - arduino
  - hw

manifest_version: 2017-05-18
  1. The result I see is:
[Jul 30 18:22:20.175] connected with TOTOLINK, channel 6
[Jul 30 18:22:20.175] dhcp client start...
[Jul 30 18:22:20.175] mgos_wifi.c:136         WiFi STA: Connected, BSSID c8:3a:35:20:00:a0 ch 6 RSSI -60
[Jul 30 18:22:20.182] mgos_net.c:89           WiFi STA: connected
[Jul 30 18:22:24.142] ip: ,mask:255.255.255.0,gw:192.168.0.1
[Jul 30 18:22:24.142] mgos_net.c:101          WiFi STA: ready, IP, GW 192.168.0.1, DNS 192.168.1.1
[Jul 30 18:22:24.147] mgos_provision_state:43 Current state: 1 -> 2
[Jul 30 18:22:24.150] mgos_mqtt.c:427         MQTT connecting to ------------.iot.us-west-2.amazonaws.com:8883
[Jul 30 18:22:24.661] mg_ssl_if_mbedtls.c:35  0x3fff24c4 ciphersuite: TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256
[Jul 30 18:22:25.110] E:M 524 (66 blocks)
[Jul 30 18:22:25.110] 
[Jul 30 18:22:25.110] Exception 29 @ 0x4000e1b2, vaddr 0x00000000
[Jul 30 18:22:25.117]  A0: 0x4029864b  A1: 0x3ffff210  A2: 0x00000000  A3: 0x00000000
[Jul 30 18:22:25.125]  A4: 0x0000020c  A5: 0x00000000  A6: 0x00000200  A7: 0x00000020
[Jul 30 18:22:25.127]  A8: 0x3ffe83cc  A9: 0x00000190 A10: 0x00000000 A11: 0x0000007c
[Jul 30 18:22:25.132] A12: 0x00000000 A13: 0x0000020c A14: 0x00000042 A15: 0x0000105e
[Jul 30 18:22:25.139] 
[Jul 30 18:22:25.139] (exc SP: 0x3ffff070)
[Jul 30 18:22:25.139] 
[Jul 30 18:22:25.142] --- BEGIN CORE DUMP ---
[Jul 30 18:22:25.142] mos: catching core dump
[Jul 30 18:22:27.986] ..
  1. Could someone help me with this problem?

Try to replace https://github.com/mongoose-os-libs/js-demo-bundle with https://github.com/mongoose-os-libs/aws to save some memory.

1 Like

Thank you! [Problem solved]

mos.yml

 libs:
          
# common mgos libs
- origin: https://github.com/mongoose-os-libs/boards
- origin: https://github.com/mongoose-os-libs/ca-bundle
- origin: https://github.com/mongoose-os-libs/i2c
- origin: https://github.com/mongoose-os-libs/rpc-service-config
- origin: https://github.com/mongoose-os-libs/rpc-service-fs
- origin: https://github.com/mongoose-os-libs/rpc-uart
- origin: https://github.com/mongoose-os-libs/spi


# libs necessary for the current app
- origin: https://github.com/mongoose-os-libs/aws
- origin: https://github.com/mongoose-os-libs/mjs
- origin: https://github.com/mongoose-os-libs/wifi
- origin: https://github.com/mongoose-os-libs/arduino-dallas-temperature