Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions ArduinoShield.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import React from 'react'

interface ArduinoShieldProps {
name?: string
children?: React.ReactNode
}

export const ArduinoShield: React.FC<ArduinoShieldProps> = ({
name = "SHIELD1",
children
}) => (
<group name={name}>
{/* Digital header (8-pin) */}
<pinheader
name="J1"
pinCount={8}
gender="female"
schFacingDirection="down"
showSilkscreenPinLabels
pcbX="-10mm"
pcbY="0mm"
pcbRotation="-90deg"
pinLabels={{
pin1: "D0",
pin2: "D1",
pin3: "D2",
pin4: "D3",
pin5: "D4",
pin6: "D5",
pin7: "D6",
pin8: "D7",
}}
/>

{/* Analog/aux header (6-pin) */}
<pinheader
name="J2"
pinCount={6}
gender="female"
schFacingDirection="down"
showSilkscreenPinLabels
pcbX="10mm"
pcbY="0mm"
pcbRotation="-90deg"
pinLabels={{
pin1: "A0",
pin2: "A1",
pin3: "A2",
pin4: "A3",
pin5: "A4",
pin6: "A5",
}}
/>

{/* Power header (8-pin) */}
<pinheader
name="J3"
pinCount={8}
gender="female"
schFacingDirection="up"
showSilkscreenPinLabels
pcbX="-10mm"
pcbY="12.7mm"
pcbRotation="-90deg"
pinLabels={{
pin1: "NC",
pin2: "IOREF",
pin3: "RESET",
pin4: "3V3",
pin5: "5V",
pin6: "GND",
pin7: "GND",
pin8: "VIN",
}}
/>

{/* PWM/Communication header (10-pin) */}
<pinheader
name="J4"
pinCount={10}
gender="female"
schFacingDirection="up"
showSilkscreenPinLabels
pcbX="10mm"
pcbY="15.24mm"
pcbRotation="-90deg"
pinLabels={{
pin1: "D8",
pin2: "D9",
pin3: "D10",
pin4: "D11",
pin5: "D12",
pin6: "D13",
pin7: "GND",
pin8: "AREF",
pin9: "SDA",
pin10: "SCL",
}}
/>

{/* Any components placed as children will be part of the shield */}
{children}
</group>
)

export default ArduinoShield
15 changes: 10 additions & 5 deletions index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
// Import the ArduinoShield component
import { ArduinoShield } from "./ArduinoShield";

export default () => (
<board>
<resistor resistance="1k" footprint="0402" name="R1" schX={3} pcbX={3} />
<capacitor capacitance="1000pF" footprint="0402" name="C1" schX={-3} pcbX={-3} />
<trace from=".R1 > .pin1" to=".C1 > .pin1" />
<board width="50mm" height="60mm">
<ArduinoShield name="MyArduinoShield">
<resistor resistance="1k" footprint="0402" name="R1" pcbX={5} pcbY={5} />
<capacitor capacitance="1000pF" footprint="0402" name="C1" pcbX={10} pcbY={5} />
<trace from=".R1 > .pin1" to=".C1 > .pin1" />
</ArduinoShield>
</board>
)
)