コード例 #1
0
void setup()
{
        pinMode(RL1, OUTPUT);
        pinMode(RL2, OUTPUT);
        pinMode(GL1, OUTPUT);
        pinMode(GL2, OUTPUT);
        pinMode(BL1, OUTPUT);
        pinMode(BL2, OUTPUT);
        pinMode(M1, OUTPUT);
        pinMode(M2, OUTPUT);
        digitalWrite(M1,HIGH);
        digitalWrite(M2, HIGH);
        analogWrite(E1, 0);
        analogWrite(E2, 0);
        //open bluetooth serial
        Serial1.begin(115200);
        Serial.begin(9600);
        Serial.println("Type AT commands!");

        /*       NEOPIXEL          */
  #if defined (__AVR_ATtiny85__)
        if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
  #endif
        pixels.begin();
        ears.begin();

        Wire.begin();


        delay(5);
        sixDOF.init(); //begin the IMU
        delay(5);
}
コード例 #2
0
void setup() {
    pinMode(PIN_DIAGNOSTIC_LED, OUTPUT);

    Serial.begin(9600);

    debug(F("initializing LED Strip\n"));
    strip.begin();
    strip.setBrightness(0xff);

    strip.show();

    Color sunset(0x80, 0x20, 0x20),
            morning(0xa0, 0x5e, 0x50),
            noon(0xff, 0xff, 0xff),
            afternoon(0xa0, 0x5e, 0x50),
            night(0x10, 0x15, 0x20);

    // switch on at 6 (use an external timer for that)
    fade(Color::OFF, sunset, minutes_to_ms(45));

    fade(sunset, morning, minutes_to_ms(30));

    fade(morning, noon, minutes_to_ms(45 + 4 * 60));

    fade(noon, noon, minutes_to_ms(4 * 60));

    fade(noon, afternoon, minutes_to_ms(2 * 60));

    fade(afternoon, sunset, minutes_to_ms(45));

    fade(sunset, night, minutes_to_ms( 30));

    fade(night, Color::OFF, minutes_to_ms(30));

}
コード例 #3
0
ファイル: arduino.cpp プロジェクト: takustaqu/bakkathon
void setup() {
  Serial.begin(9600);
  while (!Serial) {
    ;
  }
  MCUSR = 0;  // for Reset : clear out any flags of prior resets.

/*
  if(!isDebug){//TODO Servo bug fix....
    // Initialize SD card.
    Serial.print(F("\nInitializing SD card..."));
    if (card.init(SPI_HALF_SPEED, chipSelectPin)) {
      //Serial.print(F("OK"));
    } else {
      //Serial.print(F("NG"));
      abort();
    }
    memset(buffer, 0, 0x200);
  }
  */


  //For Neopixel
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'

  sv.attach(SERVO_PIN, 800, 2300);// For Servo

  pinMode(buttonPin, INPUT);// for BUtton
}
コード例 #4
0
ファイル: LearnBitsShield.cpp プロジェクト: LearnBits/Shield
// Shield initialize function:
void Init_LearnBitsShield(){
  // initialize serial ports:
  Serial.begin(57600); // Pc Communication
  Serial1.begin(57600); // Pi communication
  Serial2.begin(57600); // Bluetooth Communication

  // initialize motor driver
  pinMode(MOT_STBY, OUTPUT);
  pinMode(MOT_PWMA, OUTPUT);
  pinMode(MOT_AIN1, OUTPUT);
  pinMode(MOT_AIN2, OUTPUT);
  pinMode(MOT_PWMB, OUTPUT);
  pinMode(MOT_BIN1, OUTPUT);
  pinMode(MOT_BIN2, OUTPUT);
  digitalWrite(MOT_STBY, LOW);  //Set standby

  // initialize Neo pixels
  pixels.begin(); // initializes NeoPixel library.
  for(int ii=0;ii<NUMPIXELS;ii++){
    pixels.setPixelColor(ii, pixels.Color(0,0,0)); // Set pixel color. 
  }
  pixels.show(); // Updated pixel color Hardware.
  

}// end Init_LearnBitsShield
コード例 #5
0
ファイル: neopixel.c プロジェクト: ismailuddin/arduino
void setup() {
  // put your setup code here, to run once:
  strip.begin();
  strip.show();
  pinMode(switchPin, INPUT);

}
コード例 #6
0
ファイル: application.cpp プロジェクト: blinkingnoise/Sming
void init()
{

	Serial.begin(SERIAL_BAUD_RATE); // 115200 by default
	Serial.systemDebugOutput(false); // Disable debug output to serial

	Serial.print("NeoPixel demo .. start");


    // Wifi could be used eg. for switching Neopixel from internet
	// could be also dissabled if no needed

	WifiStation.config(WIFI_SSID, WIFI_PWD);
	WifiStation.enable(true);
	WifiAccessPoint.enable(false);
	WifiEvents.onStationDisconnect(connect_Fail);
	WifiEvents.onStationGotIP(got_IP);



	StripDemoType =0;  //demo index to be displayed

	strip.begin();  //init port

	StripDemoTimer.initializeMs(1000, StartDemo).start();  //start demo


}
コード例 #7
0
void setup()
{
  Serial.begin(115200);
  strip.begin();
  strip.setBrightness(40);
  strip.show();
  cmdMessenger.attach(kSetLED, OnSetLed);
}
コード例 #8
0
ファイル: lights.cpp プロジェクト: 0x27/redalert
void setup() {
  pixels.begin(); 
  t = millis() + TOUT * 1000;
  CMD[0] = 'F';
  
  //Change to Serial1 if using micro
  Serial.begin(9600); 
  xbee.begin(Serial);
}
コード例 #9
0
ファイル: sketch.cpp プロジェクト: MeowWolf/BeamArcade
void setup()
{
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'

  //atm buttons
  for( int i=2; i<2+9; ++i)
    pinMode(i, INPUT_PULLUP);
  Serial.begin(BAUD);
}
コード例 #10
0
 void setup () {
   strip_h.begin();
   strip_d.begin();
   strip_s.begin();
   strip_h.show();
   strip_d.show();
   strip_s.show();
   Serial.begin(57600);
   Wire.begin();
   RTC.begin();
   strip_h.setBrightness(100);
   strip_d.setBrightness(100);
   strip_s.setBrightness(100);
 
   // if (! RTC.isrunning()) {
   // Serial.println("RTC is NOT running!");
   // following line sets the RTC to the date & time this sketch was compiled
   //   RTC.adjust(DateTime(__DATE__, __TIME__));
 }
コード例 #11
0
ファイル: ColorWipeEffect.cpp プロジェクト: rootux/sabaled
ColorWipeEffect::ColorWipeEffect(Section *sections, int sectionsStart, int sectionsEnd,int* globalSpeedFactor) : 
	BaseEffect(sections, sectionsStart, sectionsEnd, globalSpeedFactor) {
		Section *sect = &sections[sectionsStart];
		Adafruit_NeoPixel *strip = sect->strip;
	strip->begin();
	strip->show();

	this->currentIndex = 0;
	this->currentStep = 5;
}
コード例 #12
0
void setup() 
{

	Spark.function("setColor1", setColor1);
	Spark.function("setColor2", setColor2);
	Spark.function("setColor3", setColor3);
	Spark.function("setPattern", setPattern);


	strip.begin();
	strip.show(); // Initialize all pixels to 'off'
}
コード例 #13
0
void SparkButton::begin(){
    ring.begin();
    ring.show();
    
    accelerometer.begin();                   // Setup SPI protocol, issue device soft reset
    accelerometer.beginMeasure();            // Switch ADXL362 to measure mode  
    accelerometer.checkAllControlRegs();     // Burst Read all Control Registers, to check for proper setup
    
    pinMode(D1, INPUT_PULLUP);
    pinMode(D2, INPUT_PULLUP);
    pinMode(D3, INPUT_PULLUP);
    pinMode(D4, INPUT_PULLUP);
}
コード例 #14
0
ファイル: rgb_sketch.cpp プロジェクト: thostr/neopixelstuff
void setup()
{
// Arduino_h is only defined when compiling the sketch in the Arduino IDE.
#ifndef Arduino_h
    // Select line, circle or grid pixel layout for emulator.
    // pixels.setPixelLayout(Strip);
    pixels.setPixelLayout(Ring);
    // pixels.setPixelLayout(Grid);
#endif
    pixels.begin();
    // setBrightness() is intended for use only in setup() and not for animations. It's ignored by the emulator (see
    // the README).
    pixels.setBrightness(50);
    pixels.show();
}
コード例 #15
0
void init()
{

	Serial.begin(115200); // 115200 by default
	Serial.systemDebugOutput(false); // Disable debug output to serial

	Serial.print("NeoPixel demo .. start");

	StripDemoType =0;  //demo index to be displayed

	strip.begin();  //init port

	StripDemoTimer.initializeMs(1000, StartDemo).start();  //start demo


}
コード例 #16
0
ファイル: neopixel.cpp プロジェクト: 3devangelist/PrusaMendel
void setup_neopixel() {
  SET_OUTPUT(NEOPIXEL_PIN);
  pixels.setBrightness(NEOPIXEL_BRIGHTNESS); // 0 - 255 range
  pixels.begin();
  pixels.show(); // initialize to all off

  #if ENABLED(NEOPIXEL_STARTUP_TEST)
    safe_delay(1000);
    set_neopixel_color(pixels.Color(255, 0, 0, 0));  // red
    safe_delay(1000);
    set_neopixel_color(pixels.Color(0, 255, 0, 0));  // green
    safe_delay(1000);
    set_neopixel_color(pixels.Color(0, 0, 255, 0));  // blue
    safe_delay(1000);
  #endif
  set_neopixel_color(pixels.Color(NEO_WHITE));       // white
}
コード例 #17
0
void setup()
{
    Serial.begin(115200);
    Serial.println("started!");
    strip1.begin();
    strip1.show();
    blinkLED(4, 250);
    
    initMPU();
    
    RGB.control(true);
    RGB.color(0, 0, 0);
    logger.begin();
    
    Spark.function("setskipvalues", setSkipValues);
    Spark.function("setaccllimit", setAccelLimit);
}
コード例 #18
0
void setup() {

 

  // This is only needed on 5V Arduinos (Uno, Leonardo, etc.).

  // Connect 3.3V to mic AND TO AREF ON ARDUINO and enable this

  // line.  Audio samples are 'cleaner' at 3.3V.

  // COMMENT OUT THIS LINE FOR 3.3V ARDUINOS (FLORA, ETC.):

analogReference(EXTERNAL); 

  memset(vol, 0, sizeof(vol));

  strip.begin();

}
コード例 #19
0
ファイル: main.cpp プロジェクト: alepar/nerf
extern "C" int main(void) {
	delay(200); // let it settle

	Serial.begin(115200);

	pinMode(PIN_LED_STATUS, OUTPUT);
    digitalWriteFast(PIN_LED_STATUS, HIGH);
	
	pinMode(PIN_JUDGE_SENSOR, INPUT);

	pinMode(PIN_RELAY_OFF, OUTPUT);
	digitalWrite(PIN_RELAY_OFF, 0);
	pinMode(PIN_RELAY_ON, OUTPUT);
	digitalWrite(PIN_RELAY_ON, 1);

	pixels.begin(); pixels.show(); // clear pixels

	curDispVal = 0;
	lastUpdateMillis = millis();

	while(1) {
		int16_t dispVal = analogRead(PIN_JUDGE_SENSOR) - MIN_SENSOR;
		uint32_t curBucket = millis() / 500;
		if (curBucket != lastWriteBucket) {
			lastWriteBucket = curBucket;
			Serial.println(analogRead(PIN_JUDGE_SENSOR));
		}

		if (dispVal < 0) dispVal = 0;
		if (dispVal > MAX_VOLT) dispVal = MAX_VOLT;

		recalcVal(dispVal);
		setVoltDisplay(curDispVal);

		if (!dispVal && !curDispVal) {
			digitalWrite(PIN_RELAY_ON, 0);
			digitalWrite(PIN_RELAY_OFF, 1);
		}
	}

}
コード例 #20
0
void InternetButton::begin(int i){
    if(i == 1 || i == 0){
        pin = 17;
        b1 = 1;
        b2 = 2;
        b3 = 3;
        b4 = 4;
    }

    ring.begin();
    ring.setPin(pin);
    ring.show();

    accelerometer.begin();                   // Setup SPI protocol, issue device soft reset
    accelerometer.beginMeasure();            // Switch ADXL362 to measure mode
    accelerometer.checkAllControlRegs();     // Burst Read all Control Registers, to check for proper setup

    pinMode(b1, INPUT_PULLUP);
    pinMode(b2, INPUT_PULLUP);
    pinMode(b3, INPUT_PULLUP);
    pinMode(b4, INPUT_PULLUP);
}
コード例 #21
0
ファイル: esp8266_fw.c プロジェクト: prashnts/dotfiles
void setup() {
  Serial.begin(115200);
  pixels.begin();
  pixels.setBrightness(BASE_BRIGHTNESS);

  reset_pixels();

  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);

  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  WiFi.hostname(HOSTNAME);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("WiFi connected");
  Serial.println(WiFi.localIP());

  if (!MDNS.begin(HOSTNAME)) {
    update_pixel(0, 200, 0, 0);
    Serial.println("Error setting up MDNS responder!");
    while (1) {
      delay(1000);
    }
  }
  Serial.println("mDNS responder started");

  update_pixel(0, 0, 200, 0);
  pixels.show();

  server.begin();
  MDNS.addService("http", "tcp", 80);
}
コード例 #22
0
ファイル: ExtendoHand.cpp プロジェクト: XixiLuo/extendo
void ExtendoHand::setupPins() {
    pinMode(VIBRO_PIN, OUTPUT);
    leds.begin();
}
コード例 #23
0
ファイル: ws2812.cpp プロジェクト: 415DomSmith/node-pixel
void ws2812_initialise() {
    // initialises the strip
    strip.begin();
    strip.show();
}
コード例 #24
0
inline void init_leds(){
	top_panels.begin();
	bottom_panels.begin();
	unsigned long int color = bottom_panels.Color(50,  0,  0 );
	set_all_leds(color);
}
コード例 #25
0
ファイル: sheet.cpp プロジェクト: deldreth/SacredDoorway
void Sheet::init () {
	strip.begin();
	strip.setBrightness(brightness); // Not really necessary, seems that the default of the library is max brightness
	strip.show(); // Initialize all pixels to 'off'
}
コード例 #26
0
void setup() {
  strip.setBrightness(BRIGHTNESS);
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}
コード例 #27
0
void setup()
{
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}