Accessory Shield for Bluno - OLED not working with motor drivers

Hello,
Sorry for maybe not complicated to solve problem. Below you can see a program which is dedicated for Romeo BLE - Bluetooth 4.0 board and Accessory Shield for Bluno. The problem is that when the motors procedure on board is enabled OLED screen is not working.
Sorry for maybe not complicated to solve problem. Below you can see a program which is dedicated for Romeo BLE - Bluetooth 4.0 board and Accessory Shield for Bluno. The problem is that when the motors procedure on board is enabled OLED screen is not working.
Code: Select all
#include "blunoAccessory.h"
#include "U8glib.h"
#include <DHT.h>
#define DHTPIN 2 // Pin which is connected to the DHT sensor.
#define DHTTYPE DHT11 // DHT 22 (AM2302)
DHT dht(DHTPIN, DHTTYPE);
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);
blunoAccessory myAccessory;
//Sensor
char Humm_buf[6];
char Temp_buf[6];
float temperature;
float humidity;
//Motor
int E1 = 5; //M1 Speed Control
int E2 = 6; //M2 Speed Control
int M1 = 4; //M1 Direction Control
int M2 = 7; //M1 Direction Control
void setup() {
u8g.setColorIndex(2); //displayMode : u8g_MODE_BW
myAccessory.begin();
dht.begin();
}
void loop() {
static unsigned long DHT11Timer=millis(); //every 2s update the temperature and humidity from DHT11 sensor
if (millis() - DHT11Timer >= 1000)
{
DHT11Timer=millis();
temperature=dht.readTemperature();
humidity=dht.readHumidity();
}
u8g.firstPage();
do
{
//motor(); //<--- problem is here
draw();
}
while(u8g.nextPage());
delay(500);
}
void draw (void)
{
dtostrf(humidity,5,0,Humm_buf);
dtostrf(temperature,5,0,Temp_buf);
u8g.setFont(u8g_font_unifont);
u8g.drawStr(0,22,"Humidity ");
u8g.drawStr(70,22,Humm_buf);
u8g.drawStr(113,22,"%");
u8g.drawStr(0,44,"Temperature ");
u8g.drawStr(70,44,Temp_buf);
u8g.drawCircle(113,37,2);
u8g.drawStr(117,44,"C");
}
void motor(void)
{
digitalWrite(M1, LOW); //LOW or HIGH
analogWrite (E1, 255); //PWM Speed Control
digitalWrite(M2, HIGH); //LOW or HIGH
analogWrite (E2, 100); //PWM Speed Control
}
2017-11-16 17:50:44 This relay is connected to digital pin 11, I don't think it could control the speed and direction, it can only make the motor rotate, and I think it should be a small motor since the voltage and current is comparatively low
robert.chen
