「Laravel」Laravel Debugbar

Install use Composer

# composer require barryvdh/laravel-debugbar --dev
composer require barryvdh/laravel-debugbar:^2.3 --dev

P.S.You can find information in composer.json

set service provider AppServiceProvider.php

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        //
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {

        // ===== THIS IS Register LARAVEL DEBUGBAR 
        if ($this->app->environment() == 'local')
        {
            $this->app->register('Barryvdh\Debugbar\ServiceProvider');
        }
        //==========================

    }
}

set Facade config/app.php:

    'aliases' => [

        ...............        

        // Laravel Debugbar
        'Debugbar' => Barryvdh\Debugbar\Facade::class,

    ],

];

check .env


APP_ENV=local
APP_DEBUG=true

參考

  1. https://my.oschina.net/u/2400083/blog/988715

「Laravel」 composer

install composer

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
sudo chmod +x /usr/local/bin/composer

instasll laravel


composer create-project --prefer-dist laravel/laravel PROJECT

raspberry pi 最近在使用 raspberry pi 困惑很久的問題 大概就是 bounce了,

由於對於電子學不太熟悉,有些問題卡了蠻久的,

甚至一開始認為是raspberry 的問題,還把整個input的線路轉成arduino做,

結果也是一樣,最後瞭解了bounce後才解決這些小問題。

bounce

關於 bounce這是一種 機械開關常見的彈跳現象,

就我的理解,當在開關按下或離開的瞬間,這個過程中會發現很多 on 和 off ,

即使沒點開關,在某種震動或晃動的情況,也會發生會使電路判斷錯誤的 on/off。

基本上我的解決辦法是將arduino的delay設30(低於50),讓他一直loop,做檢查。

檢查3次相同的值 就確定他觸發這個按鈕的動作。

3次的間隔都為30,總時間就為90,這樣設定後就在也沒發生錯誤的現象了。

arduino 中間程式像是這樣

  int forward_backward_pin = digitalRead(7);
  int right_left_pin = digitalRead(6);
  int up_pin = digitalRead(5);
  int down_pin = digitalRead(4);
  if( forward_backward_pin != forward_backward_status || right_left_pin != right_left_status || up_pin != up_status || down_status != down_pin){
      set_val_tag++;
      if( set_val_tag > 3 ){
        forward_backward_status = forward_backward_pin;
        right_left_status = right_left_pin;
        up_status = up_pin;
        down_status = down_pin;
        set_val_tag =0;
              Serial.println("{\"type\":\"loop\",\"forward_backward_pin\":"+
                    String(forward_backward_pin, DEC)+",\"up_pin\":"+
                    String(up_pin, DEC)+",\"down_pin\":"+
                    String(down_pin, DEC)+",\"right_left_pin\":"+
                    String(right_left_pin, DEC)+"}");
      }

  }

delay (30);

剩下的raspberry pi 主要都用 python進行開發,寫起來也比arduino舒服,再搭配上docker 很方便。