Skip to content

Commit 8fbfd19

Browse files
committed
feat: add ntc temperature sensor
1 parent 6b9495c commit 8fbfd19

File tree

4 files changed

+144
-0
lines changed

4 files changed

+144
-0
lines changed

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ export { AnalogJoystickElement } from './analog-joystick-element';
2828
export { IRReceiverElement } from './ir-receiver-element';
2929
export { IRRemoteElement } from './ir-remote-element';
3030
export { PIRMotionSensorElement } from './pir-motion-sensor-element';
31+
export { NTCTemperatureSensorElement } from './ntc-temperature-sensor-element';
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { html } from 'lit-html';
2+
import './ntc-temperature-sensor-element';
3+
4+
export default {
5+
title: 'NTC Temperature Sensor',
6+
component: 'wokwi-ntc-temperature-sensor',
7+
};
8+
9+
const Template = () => html` <wokwi-ntc-temperature-sensor></wokwi-ntc-temperature-sensor> `;
10+
11+
export const Default = Template.bind({});

src/ntc-temperature-sensor-element.ts

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
import { customElement, html, LitElement } from 'lit-element';
2+
import { ElementPin, GND, VCC } from './pin';
3+
4+
@customElement('wokwi-ntc-temperature-sensor')
5+
export class NTCTemperatureSensorElement extends LitElement {
6+
readonly pinInfo: ElementPin[] = [
7+
{ name: 'GND', y: 26.2, x: 135, number: 1, signals: [GND()] },
8+
{ name: 'VCC', y: 35.8, x: 135, number: 2, signals: [VCC()] },
9+
{ name: 'OUT', y: 45.5, x: 135, number: 3, signals: [] },
10+
];
11+
12+
render() {
13+
return html`
14+
<svg
15+
width="35.826mm"
16+
height="19mm"
17+
version="1.1"
18+
viewBox="0 0 135.4 71.782"
19+
xmlns="http://www.w3.org/2000/svg"
20+
>
21+
<defs>
22+
<clipPath id="a">
23+
<path
24+
d="m15.336 49.725c-0.945 0.682-2.127 1.088-3.411 1.088-3.104 0-5.612-2.374-5.612-5.281s2.508-5.281 5.612-5.281c1.038 0 2.009 0.266 2.842 0.728 2.108 0.79 3.314 1.004 5.699 0.917 0 0-2.134 1.335-1.968 2.97 0.149 1.458 3.053 2.494 3.053 2.494-2.438 0.388-4.177 1.403-6.215 2.365z"
25+
/>
26+
</clipPath>
27+
</defs>
28+
<path
29+
d="m115.3 0h-90.421v71.782h90.421zm-66.145 56.313c3.27 0 5.925 2.608 5.925 5.878s-2.655 5.924-5.925 5.924-5.925-2.654-5.925-5.924 2.655-5.878 5.925-5.878zm16.013-7.96c3.27 0 5.925 2.654 5.925 5.924s-2.655 5.925-5.925 5.925-5.924-2.655-5.924-5.925 2.654-5.924 5.924-5.924zm-33.698 1.324c2.29 0 4.149 1.859 4.149 4.148 0 2.29-1.859 4.149-4.149 4.149-2.289 0-4.148-1.859-4.148-4.149 0-2.289 1.859-4.148 4.148-4.148zm59.914 0.635c2.041 0 3.698 1.657 3.698 3.698s-1.657 3.698-3.698 3.698-3.698-1.657-3.698-3.698 1.657-3.698 3.698-3.698zm-11.4-8.143c2.041 0 3.698 1.657 3.698 3.698s-1.657 3.698-3.698 3.698-3.698-1.657-3.698-3.698 1.657-3.698 3.698-3.698zm-14.816-1.811c2.041 0 3.698 1.657 3.698 3.698s-1.657 3.698-3.698 3.698-3.698-1.657-3.698-3.698 1.657-3.698 3.698-3.698zm0-15.974c2.041 0 3.698 1.657 3.698 3.698s-1.657 3.698-3.698 3.698-3.698-1.657-3.698-3.698 1.657-3.698 3.698-3.698zm14.816-3.203c2.041 0 3.698 1.657 3.698 3.698s-1.657 3.698-3.698 3.698-3.698-1.657-3.698-3.698 1.657-3.698 3.698-3.698zm-14.816-9.601c3.27 0 5.925 2.654 5.925 5.924s-2.655 5.925-5.925 5.925-5.924-2.655-5.924-5.925 2.654-5.924 5.924-5.924zm-33.698 2.228c2.29 0 4.149 1.859 4.149 4.148 0 2.29-1.859 4.149-4.149 4.149-2.289 0-4.148-1.859-4.148-4.149 0-2.289 1.859-4.148 4.148-4.148zm59.914 0.288c2.041 0 3.698 1.657 3.698 3.698s-1.657 3.698-3.698 3.698-3.698-1.657-3.698-3.698 1.657-3.698 3.698-3.698zm-48.154-5.701c0-1.635 2.963-4.729 5.925-4.729s5.925 3.094 5.925 4.729c0 3.27-2.655 7.121-5.925 7.121s-5.925-3.851-5.925-7.121z"
30+
fill="#0f3661"
31+
/>
32+
<path
33+
d="m104.45 21.602v28.578h8.389v-28.578z"
34+
fill="none"
35+
stroke="#fff"
36+
stroke-width=".9px"
37+
/>
38+
<g fill="#29261c">
39+
<path d="m105.37 42.328v6.554h6.554v-6.554z" />
40+
<path d="m105.37 32.604v6.554h6.554v-6.554z" />
41+
<path d="m105.37 22.865v6.554h6.554v-6.554z" />
42+
</g>
43+
<g fill="#9f9f9f">
44+
<path
45+
d="m108.85 44.165c-0.382 0-0.749 0.151-1.019 0.422-0.27 0.27-0.422 0.636-0.422 1.018v1e-3c0 0.382 0.152 0.748 0.422 1.018s0.637 0.422 1.019 0.422h26.131c0.234 0 0.424-0.189 0.424-0.423v-2.035c0-0.234-0.19-0.423-0.424-0.423h-26.131z"
46+
/>
47+
<path
48+
d="m108.85 34.441c-0.382 0-0.749 0.151-1.019 0.422-0.27 0.27-0.422 0.636-0.422 1.018v1e-3c0 0.382 0.152 0.748 0.422 1.018s0.637 0.422 1.019 0.422h26.131c0.234 0 0.424-0.189 0.424-0.423v-2.035c0-0.234-0.19-0.423-0.424-0.423h-26.131z"
49+
/>
50+
<path
51+
d="m108.85 24.701c-0.382 0-0.749 0.152-1.019 0.422-0.27 0.271-0.422 0.637-0.422 1.019s0.152 0.749 0.422 1.019 0.637 0.422 1.019 0.422h26.131c0.234 0 0.424-0.19 0.424-0.423v-2.035c0-0.234-0.19-0.424-0.424-0.424h-26.131z"
52+
/>
53+
</g>
54+
<path d="m96.494 43.126v-14.495h-4.787v14.495z" fill="#bbb9b9" />
55+
<path d="m96.661 39.537v-7.317h-5.121v7.317z" fill="#29261c" />
56+
<g fill="none" stroke="#bbb9b9" stroke-linejoin="miter">
57+
<circle cx="31.465" cy="17.956" r="4.149" stroke-width="2.5px" />
58+
<circle cx="31.465" cy="53.825" r="4.149" stroke-width="2.5px" />
59+
<circle cx="65.163" cy="54.277" r="5.925" stroke-width=".95px" />
60+
<circle cx="65.163" cy="17.504" r="5.925" stroke-width=".95px" />
61+
<circle cx="65.163" cy="28.082" r="3.698" stroke-width="2.23px" />
62+
<circle cx="65.163" cy="44.056" r="3.698" stroke-width="2.23px" />
63+
<circle cx="49.15" cy="62.191" r="5.925" stroke-width=".75px" />
64+
<circle cx="49.15" cy="9.591" r="5.925" stroke-width=".75px" />
65+
</g>
66+
<ellipse cx="48.82" cy="25.397" rx="6.375" ry="4.839" fill="#bababa" />
67+
<ellipse cx="48.82" cy="46.384" rx="6.375" ry="4.839" fill="#bbb9b9" />
68+
<circle cx="48.82" cy="25.397" r="2.612" fill="#eceee9" />
69+
<circle cx="48.82" cy="46.384" r="2.612" fill="#eceee9" />
70+
<path
71+
d="m48.82 25.397c-8.828 4.288-19.813 9.008-38 11.393"
72+
fill="none"
73+
stroke="#d6d8d4"
74+
stroke-linejoin="miter"
75+
stroke-width=".95px"
76+
/>
77+
<path
78+
d="m48.82 45.922c-9.482-5.223-20.452-6.013-38-4.789"
79+
fill="none"
80+
stroke="#d8d8d3"
81+
stroke-linejoin="miter"
82+
stroke-width=".95px"
83+
/>
84+
<path
85+
d="m9.023 43.72c-0.945 0.682-2.127 1.088-3.411 1.088-3.104 0-5.612-2.374-5.612-5.281s2.508-5.281 5.612-5.281c1.038 0 2.009 0.266 2.842 0.728 2.108 0.79 3.314 1.004 5.699 0.917 0 0-2.134 1.335-1.968 2.97 0.149 1.458 3.053 2.494 3.053 2.494-2.438 0.388-4.177 1.403-6.215 2.365z"
86+
fill="#151312"
87+
/>
88+
<g transform="translate(-6.313,-6.005)" clip-path="url(#a)">
89+
<path
90+
d="m16.648 41.782c-0.617 0-1.284-0.077-1.895 0-2.276 0.284-4.755 1.806-6.429 3.282-0.732 0.645-1.351 1.332-1.854 2.171-0.172 0.287-0.363 0.562-0.527 0.852-8e-3 0.012-0.215 0.396-0.248 0.362-0.152-0.151-0.044-0.995-0.044-1.151 0-1.394 0.015-2.694 0.341-4.059 0.435-1.827 0.867-4.205 2.407-5.497 0.593-0.497 1.419-0.714 2.138-0.941 0.989-0.311 2.096-0.55 3.145-0.406 1.754 0.241 3.113 2.109 3.428 3.768 0.08 0.421-0.08 0.892-0.08 1.31"
91+
fill="#615a59"
92+
/>
93+
</g>
94+
<g r="3.698" fill="none" stroke="#bbb9b9" stroke-linejoin="miter" stroke-width="2.23px">
95+
<circle cx="91.379" cy="17.794" />
96+
<circle cx="91.379" cy="54.01" />
97+
</g>
98+
99+
<path
100+
d="m79.979 41.028c3.519 0 6.375 2.168 6.375 4.839 0 2.67-2.856 4.839-6.375 4.839-3.518 0-6.375-2.169-6.375-4.839 0-2.671 2.857-4.839 6.375-4.839zm0 1.141c2.041 0 3.698 1.657 3.698 3.698s-1.657 3.698-3.698 3.698-3.698-1.657-3.698-3.698 1.657-3.698 3.698-3.698z"
101+
fill="#bbb9b9"
102+
/>
103+
<path
104+
d="m79.979 20.04c3.519 0 6.375 2.169 6.375 4.839 0 2.671-2.856 4.839-6.375 4.839-3.518 0-6.375-2.168-6.375-4.839 0-2.67 2.857-4.839 6.375-4.839zm0 1.141c2.041 0 3.698 1.657 3.698 3.698s-1.657 3.698-3.698 3.698-3.698-1.657-3.698-3.698 1.657-3.698 3.698-3.698z"
105+
fill="#bbb9b9"
106+
/>
107+
<path
108+
d="m89.905 44.462v-17.142h8.391v17.142z"
109+
fill="none"
110+
stroke="#fff"
111+
stroke-linejoin="miter"
112+
stroke-width=".65px"
113+
/>
114+
<g fill="#fffefe" font-family="sans-serif">
115+
<text transform="rotate(-90)">
116+
<tspan x="-39.297 -37.036 -34.776" y="95.418" font-size="3.735px">
117+
103
118+
</tspan>
119+
<tspan x="-61.485" y="111.57" font-size="9.778px">S</tspan>
120+
<tspan x="-15.512" y="111.573" font-size="15.828px">-</tspan>
121+
<tspan x="-39.152" y="36.819" font-size="9.778px">A</tspan>
122+
</text>
123+
<text transform="rotate(90)" font-size="6.072px">
124+
<tspan x="32.449 36.797" y="-40.011">S1</tspan>
125+
</text>
126+
</g>
127+
</svg>
128+
`;
129+
}
130+
}

src/react-types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { AnalogJoystickElement } from './analog-joystick-element';
2727
import { IRReceiverElement } from './ir-receiver-element';
2828
import { IRRemoteElement } from './ir-remote-element';
2929
import { PIRMotionSensorElement } from './pir-motion-sensor-element';
30+
import { NTCTemperatureSensorElement } from './ntc-temperature-sensor-element';
3031

3132
type WokwiElement<T> = Partial<T> & React.ClassAttributes<T>;
3233

@@ -59,6 +60,7 @@ declare global {
5960
'wokwi-ir-receiver': WokwiElement<IRReceiverElement>;
6061
'wokwi-ir-remote': WokwiElement<IRRemoteElement>;
6162
'wokwi-pir-motion-sensor': WokwiElement<PIRMotionSensorElement>;
63+
'wokwi-ntc-temperature-sensor': WokwiElement<NTCTemperatureSensorElement>;
6264
}
6365
}
6466
}

0 commit comments

Comments
 (0)